2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
* This file incorporates work covered by the following license notice:
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2005-01-11 12:00:28 +00:00
|
|
|
#include <com/sun/star/io/XStream.hpp>
|
2009-11-16 16:49:18 +01:00
|
|
|
#include <com/sun/star/lang/Locale.hpp>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <tools/urlobj.hxx>
|
2013-04-05 18:40:39 +02:00
|
|
|
#include <i18nlangtag/mslangid.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <vcl/svapp.hxx>
|
2014-01-02 23:52:37 +01:00
|
|
|
#include <vcl/settings.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <sot/storinfo.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/fstathelper.hxx>
|
2000-10-11 13:41:36 +00:00
|
|
|
#include <svtools/helpopt.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/urihelper.hxx>
|
2000-10-18 10:45:13 +00:00
|
|
|
#include <unotools/charclass.hxx>
|
2012-06-21 17:39:01 +01:00
|
|
|
#include <com/sun/star/i18n/UnicodeType.hpp>
|
2001-05-11 17:20:34 +00:00
|
|
|
#include <unotools/collatorwrapper.hxx>
|
|
|
|
#include <com/sun/star/i18n/CollatorOptions.hpp>
|
2010-12-29 11:28:47 +01:00
|
|
|
#include <com/sun/star/i18n/UnicodeScript.hpp>
|
2013-02-01 17:35:50 +02:00
|
|
|
#include <com/sun/star/i18n/OrdinalSuffix.hpp>
|
2001-05-11 17:20:34 +00:00
|
|
|
#include <unotools/localedatawrapper.hxx>
|
2001-11-13 17:46:50 +00:00
|
|
|
#include <unotools/transliterationwrapper.hxx>
|
2001-05-11 17:20:34 +00:00
|
|
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
2002-09-17 11:28:37 +00:00
|
|
|
#include <com/sun/star/io/XActiveDataSource.hpp>
|
2012-07-04 23:58:05 +01:00
|
|
|
#include <comphelper/processfactory.hxx>
|
|
|
|
#include <comphelper/storagehelper.hxx>
|
|
|
|
#include <comphelper/string.hxx>
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/editids.hrc>
|
2005-01-11 12:00:28 +00:00
|
|
|
#include <sot/storage.hxx>
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/udlnitem.hxx>
|
|
|
|
#include <editeng/wghtitem.hxx>
|
2016-11-22 14:41:33 +00:00
|
|
|
#include <editeng/postitem.hxx>
|
|
|
|
#include <editeng/crossedoutitem.hxx>
|
2013-02-12 13:41:53 -05:00
|
|
|
#include <editeng/escapementitem.hxx>
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/svxacorr.hxx>
|
|
|
|
#include <editeng/unolingu.hxx>
|
2016-02-13 00:29:50 +11:00
|
|
|
#include <vcl/window.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <helpid.hrc>
|
2001-02-09 17:00:24 +00:00
|
|
|
#include <com/sun/star/xml/sax/InputSource.hpp>
|
2014-10-24 08:36:08 +00:00
|
|
|
#include <com/sun/star/xml/sax/FastParser.hpp>
|
|
|
|
#include <com/sun/star/xml/sax/FastToken.hpp>
|
2012-10-10 10:13:18 +02:00
|
|
|
#include <com/sun/star/xml/sax/Writer.hpp>
|
2014-10-24 08:36:08 +00:00
|
|
|
#include <com/sun/star/xml/sax/FastTokenHandler.hpp>
|
2001-02-09 17:00:24 +00:00
|
|
|
#include <unotools/streamwrap.hxx>
|
2001-03-09 16:36:38 +00:00
|
|
|
#include <SvXMLAutoCorrectImport.hxx>
|
|
|
|
#include <SvXMLAutoCorrectExport.hxx>
|
2014-10-24 08:36:08 +00:00
|
|
|
#include <SvXMLAutoCorrectTokenHandler.hxx>
|
2001-05-02 15:18:26 +00:00
|
|
|
#include <ucbhelper/content.hxx>
|
|
|
|
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
|
|
|
|
#include <com/sun/star/ucb/TransferInfo.hpp>
|
|
|
|
#include <com/sun/star/ucb/NameClash.hpp>
|
2001-07-10 15:45:10 +00:00
|
|
|
#include <xmloff/xmltoken.hxx>
|
2009-12-11 00:02:35 +01:00
|
|
|
#include <vcl/help.hxx>
|
2015-01-01 19:58:59 +00:00
|
|
|
#include <set>
|
|
|
|
#include <unordered_map>
|
2016-06-21 11:45:30 +03:00
|
|
|
#include <rtl/character.hxx>
|
2001-02-09 17:00:24 +00:00
|
|
|
|
2001-05-02 15:18:26 +00:00
|
|
|
using namespace ::com::sun::star::ucb;
|
2001-02-09 17:00:24 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
2014-10-24 08:36:08 +00:00
|
|
|
using namespace ::com::sun::star::xml::sax;
|
2001-02-09 17:00:24 +00:00
|
|
|
using namespace ::com::sun::star;
|
2001-07-10 15:45:10 +00:00
|
|
|
using namespace ::xmloff::token;
|
2001-11-13 17:46:50 +00:00
|
|
|
using namespace ::utl;
|
2000-10-18 10:45:13 +00:00
|
|
|
|
2016-09-21 16:09:53 +02:00
|
|
|
enum class Flags {
|
|
|
|
NONE = 0x00,
|
|
|
|
FullStop = 0x01,
|
|
|
|
ExclamationMark = 0x02,
|
|
|
|
QuestionMark = 0x04,
|
|
|
|
};
|
|
|
|
namespace o3tl {
|
|
|
|
template<> struct typed_flags<Flags> : is_typed_flags<Flags, 0x07> {};
|
|
|
|
}
|
2013-09-22 00:19:12 +02:00
|
|
|
static const sal_Unicode cNonBreakingSpace = 0xA0;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-09 17:00:24 +00:00
|
|
|
static const sal_Char pXMLImplWrdStt_ExcptLstStr[] = "WordExceptList.xml";
|
|
|
|
static const sal_Char pXMLImplCplStt_ExcptLstStr[] = "SentenceExceptList.xml";
|
|
|
|
static const sal_Char pXMLImplAutocorr_ListStr[] = "DocumentList.xml";
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
static const sal_Char
|
2011-02-16 16:34:02 -05:00
|
|
|
/* also at these beginnings - Brackets and all kinds of begin characters */
|
2000-09-18 16:07:07 +00:00
|
|
|
sImplSttSkipChars[] = "\"\'([{\x83\x84\x89\x91\x92\x93\x94",
|
2011-02-16 16:34:02 -05:00
|
|
|
/* also at these ends - Brackets and all kinds of begin characters */
|
2000-09-18 16:07:07 +00:00
|
|
|
sImplEndSkipChars[] = "\"\')]}\x83\x84\x89\x91\x92\x93\x94";
|
|
|
|
|
2013-09-08 16:34:47 +01:00
|
|
|
OUString EncryptBlockName_Imp(const OUString& rName);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-01-14 21:09:59 +01:00
|
|
|
static inline bool IsWordDelim( const sal_Unicode c )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return ' ' == c || '\t' == c || 0x0a == c ||
|
2013-09-22 00:19:12 +02:00
|
|
|
cNonBreakingSpace == c || 0x2011 == c || 0x1 == c;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2016-07-01 14:38:54 +01:00
|
|
|
static inline bool IsAutoCapitalizeWordDelim( const sal_Unicode c )
|
|
|
|
{
|
|
|
|
return ' ' == c || '\t' == c || 0x0a == c ||
|
|
|
|
cNonBreakingSpace == c || 0x2011 == c;
|
|
|
|
}
|
|
|
|
|
2014-01-14 21:09:59 +01:00
|
|
|
static inline bool IsLowerLetter( sal_Int32 nCharType )
|
2000-10-18 10:45:13 +00:00
|
|
|
{
|
|
|
|
return CharClass::isLetterType( nCharType ) &&
|
2016-11-28 13:01:40 +00:00
|
|
|
( css::i18n::KCharacterType::LOWER & nCharType);
|
2000-10-18 10:45:13 +00:00
|
|
|
}
|
2012-01-09 01:00:30 -05:00
|
|
|
|
2014-01-14 21:09:59 +01:00
|
|
|
static inline bool IsUpperLetter( sal_Int32 nCharType )
|
2000-10-18 10:45:13 +00:00
|
|
|
{
|
|
|
|
return CharClass::isLetterType( nCharType ) &&
|
2016-11-28 13:01:40 +00:00
|
|
|
( css::i18n::KCharacterType::UPPER & nCharType);
|
2000-10-18 10:45:13 +00:00
|
|
|
}
|
|
|
|
|
2013-09-20 13:47:10 +02:00
|
|
|
bool lcl_IsUnsupportedUnicodeChar( CharClass& rCC, const OUString& rTxt,
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 nStt, sal_Int32 nEnd )
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
{
|
|
|
|
for( ; nStt < nEnd; ++nStt )
|
|
|
|
{
|
|
|
|
short nScript = rCC.getScript( rTxt, nStt );
|
|
|
|
switch( nScript )
|
|
|
|
{
|
2015-09-11 15:44:09 +02:00
|
|
|
case css::i18n::UnicodeScript_kCJKRadicalsSupplement:
|
|
|
|
case css::i18n::UnicodeScript_kHangulJamo:
|
|
|
|
case css::i18n::UnicodeScript_kCJKSymbolPunctuation:
|
|
|
|
case css::i18n::UnicodeScript_kHiragana:
|
|
|
|
case css::i18n::UnicodeScript_kKatakana:
|
|
|
|
case css::i18n::UnicodeScript_kHangulCompatibilityJamo:
|
|
|
|
case css::i18n::UnicodeScript_kEnclosedCJKLetterMonth:
|
|
|
|
case css::i18n::UnicodeScript_kCJKCompatibility:
|
|
|
|
case css::i18n::UnicodeScript_k_CJKUnifiedIdeographsExtensionA:
|
|
|
|
case css::i18n::UnicodeScript_kCJKUnifiedIdeograph:
|
|
|
|
case css::i18n::UnicodeScript_kHangulSyllable:
|
|
|
|
case css::i18n::UnicodeScript_kCJKCompatibilityIdeograph:
|
|
|
|
case css::i18n::UnicodeScript_kHalfwidthFullwidthForm:
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
return true;
|
|
|
|
default: ; //do nothing
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
static bool lcl_IsSymbolChar( CharClass& rCC, const OUString& rTxt,
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 nStt, sal_Int32 nEnd )
|
2000-10-18 10:45:13 +00:00
|
|
|
{
|
|
|
|
for( ; nStt < nEnd; ++nStt )
|
|
|
|
{
|
2015-09-11 15:44:09 +02:00
|
|
|
if( css::i18n::UnicodeType::PRIVATE_USE == rCC.getType( rTxt, nStt ))
|
2014-02-26 11:01:45 +02:00
|
|
|
return true;
|
2000-10-18 10:45:13 +00:00
|
|
|
}
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-10-18 10:45:13 +00:00
|
|
|
}
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
static bool lcl_IsInAsciiArr( const sal_Char* pArr, const sal_Unicode c )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bRet = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
for( ; *pArr; ++pArr )
|
|
|
|
if( *pArr == c )
|
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
bRet = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxAutoCorrDoc::~SvxAutoCorrDoc()
|
|
|
|
{
|
|
|
|
}
|
2013-02-15 13:57:25 +00:00
|
|
|
|
|
|
|
// Called by the functions:
|
2015-05-26 09:52:08 +02:00
|
|
|
// - FnCapitalStartWord
|
2015-05-26 09:49:42 +02:00
|
|
|
// - FnCapitalStartSentence
|
2013-02-15 13:57:25 +00:00
|
|
|
// after the exchange of characters. Then the words, if necessary, can be inserted
|
|
|
|
// into the exception list.
|
2014-01-15 10:14:52 +00:00
|
|
|
void SvxAutoCorrDoc::SaveCpltSttWord( sal_uLong, sal_Int32, const OUString&,
|
2000-09-18 16:07:07 +00:00
|
|
|
sal_Unicode )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-03-17 14:27:08 +02:00
|
|
|
LanguageType SvxAutoCorrDoc::GetLanguage( sal_Int32 ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return LANGUAGE_SYSTEM;
|
|
|
|
}
|
|
|
|
|
2012-11-24 18:54:09 +01:00
|
|
|
static const LanguageTag& GetAppLang()
|
2001-05-11 17:20:34 +00:00
|
|
|
{
|
2012-11-24 18:54:09 +01:00
|
|
|
return Application::GetSettings().GetLanguageTag();
|
2001-05-11 17:20:34 +00:00
|
|
|
}
|
2011-01-13 14:12:48 +01:00
|
|
|
static LocaleDataWrapper& GetLocaleDataWrapper( sal_uInt16 nLang )
|
2001-05-11 17:20:34 +00:00
|
|
|
{
|
2012-11-24 18:54:09 +01:00
|
|
|
static LocaleDataWrapper aLclDtWrp( GetAppLang() );
|
|
|
|
LanguageTag aLcl( nLang );
|
2012-11-23 23:06:10 +01:00
|
|
|
const LanguageTag& rLcl = aLclDtWrp.getLoadedLanguageTag();
|
|
|
|
if( aLcl != rLcl )
|
|
|
|
aLclDtWrp.setLanguageTag( aLcl );
|
2001-11-13 17:46:50 +00:00
|
|
|
return aLclDtWrp;
|
2001-05-11 17:20:34 +00:00
|
|
|
}
|
2001-11-13 17:46:50 +00:00
|
|
|
static TransliterationWrapper& GetIgnoreTranslWrapper()
|
2001-05-11 17:20:34 +00:00
|
|
|
{
|
|
|
|
static int bIsInit = 0;
|
2012-11-02 09:46:12 +02:00
|
|
|
static TransliterationWrapper aWrp( ::comphelper::getProcessComponentContext(),
|
2015-09-11 15:44:09 +02:00
|
|
|
css::i18n::TransliterationModules_IGNORE_KANA |
|
|
|
|
css::i18n::TransliterationModules_IGNORE_WIDTH );
|
2001-05-11 17:20:34 +00:00
|
|
|
if( !bIsInit )
|
|
|
|
{
|
2012-11-24 18:54:09 +01:00
|
|
|
aWrp.loadModuleIfNeeded( GetAppLang().getLanguageType() );
|
2001-05-11 17:20:34 +00:00
|
|
|
bIsInit = 1;
|
|
|
|
}
|
2001-11-13 17:46:50 +00:00
|
|
|
return aWrp;
|
2001-05-11 17:20:34 +00:00
|
|
|
}
|
2001-11-13 17:46:50 +00:00
|
|
|
static CollatorWrapper& GetCollatorWrapper()
|
2001-05-11 17:20:34 +00:00
|
|
|
{
|
|
|
|
static int bIsInit = 0;
|
2012-11-20 12:57:26 +02:00
|
|
|
static CollatorWrapper aCollWrp( ::comphelper::getProcessComponentContext() );
|
2001-05-11 17:20:34 +00:00
|
|
|
if( !bIsInit )
|
|
|
|
{
|
2012-11-24 18:54:09 +01:00
|
|
|
aCollWrp.loadDefaultCollator( GetAppLang().getLocale(), 0 );
|
2001-05-11 17:20:34 +00:00
|
|
|
bIsInit = 1;
|
|
|
|
}
|
|
|
|
return aCollWrp;
|
|
|
|
}
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrect::IsAutoCorrectChar( sal_Unicode cChar )
|
2006-11-22 10:26:08 +00:00
|
|
|
{
|
|
|
|
return cChar == '\0' || cChar == '\t' || cChar == 0x0a ||
|
|
|
|
cChar == ' ' || cChar == '\'' || cChar == '\"' ||
|
2011-10-24 11:01:36 +02:00
|
|
|
cChar == '*' || cChar == '_' || cChar == '%' ||
|
2006-11-22 10:26:08 +00:00
|
|
|
cChar == '.' || cChar == ',' || cChar == ';' ||
|
2013-02-23 13:58:18 -05:00
|
|
|
cChar == ':' || cChar == '?' || cChar == '!' ||
|
2016-11-22 14:41:33 +00:00
|
|
|
cChar == '/' || cChar == '-';
|
2016-09-21 20:34:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
bool IsCompoundWordDelimChar(sal_Unicode cChar)
|
|
|
|
{
|
|
|
|
return cChar == '-' || SvxAutoCorrect::IsAutoCorrectChar(cChar);
|
|
|
|
}
|
2010-01-21 13:58:49 +01:00
|
|
|
}
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrect::NeedsHardspaceAutocorr( sal_Unicode cChar )
|
2010-01-21 13:58:49 +01:00
|
|
|
{
|
2011-10-24 11:01:36 +02:00
|
|
|
return cChar == '%' || cChar == ';' || cChar == ':' || cChar == '?' || cChar == '!' ||
|
2010-01-21 13:58:49 +01:00
|
|
|
cChar == '/' /*case for the urls exception*/;
|
2006-11-22 10:26:08 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
long SvxAutoCorrect::GetDefaultFlags()
|
|
|
|
{
|
|
|
|
long nRet = Autocorrect
|
2015-05-26 09:49:42 +02:00
|
|
|
| CapitalStartSentence
|
2015-05-26 09:52:08 +02:00
|
|
|
| CapitalStartWord
|
2000-09-18 16:07:07 +00:00
|
|
|
| ChgOrdinalNumber
|
|
|
|
| ChgToEnEmDash
|
2009-11-16 16:49:18 +01:00
|
|
|
| AddNonBrkSpace
|
2000-09-18 16:07:07 +00:00
|
|
|
| ChgWeightUnderl
|
|
|
|
| SetINetAttr
|
|
|
|
| ChgQuotes
|
|
|
|
| SaveWordCplSttLst
|
2010-09-29 16:20:12 -04:00
|
|
|
| SaveWordWrdSttLst
|
|
|
|
| CorrectCapsLock;
|
2012-11-24 18:54:09 +01:00
|
|
|
LanguageType eLang = GetAppLang().getLanguageType();
|
2000-09-18 16:07:07 +00:00
|
|
|
switch( eLang )
|
|
|
|
{
|
|
|
|
case LANGUAGE_ENGLISH:
|
|
|
|
case LANGUAGE_ENGLISH_US:
|
|
|
|
case LANGUAGE_ENGLISH_UK:
|
|
|
|
case LANGUAGE_ENGLISH_AUS:
|
|
|
|
case LANGUAGE_ENGLISH_CAN:
|
|
|
|
case LANGUAGE_ENGLISH_NZ:
|
|
|
|
case LANGUAGE_ENGLISH_EIRE:
|
|
|
|
case LANGUAGE_ENGLISH_SAFRICA:
|
|
|
|
case LANGUAGE_ENGLISH_JAMAICA:
|
|
|
|
case LANGUAGE_ENGLISH_CARRIBEAN:
|
|
|
|
nRet &= ~(ChgQuotes|ChgSglQuotes);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return nRet;
|
|
|
|
}
|
2000-10-18 10:45:13 +00:00
|
|
|
|
|
|
|
|
2013-09-16 13:36:27 +02:00
|
|
|
SvxAutoCorrect::SvxAutoCorrect( const OUString& rShareAutocorrFile,
|
|
|
|
const OUString& rUserAutocorrFile )
|
2014-02-05 13:37:06 -06:00
|
|
|
: sShareAutoCorrFile( rShareAutocorrFile )
|
|
|
|
, sUserAutoCorrFile( rUserAutocorrFile )
|
2015-07-17 18:19:29 +02:00
|
|
|
, m_pLangTable( new std::map<LanguageTag, std::unique_ptr<SvxAutoCorrectLanguageLists>> )
|
2015-11-10 10:14:16 +01:00
|
|
|
, pCharClass( nullptr )
|
2014-02-05 13:37:06 -06:00
|
|
|
, bRunNext( false )
|
|
|
|
, eCharClassLang( LANGUAGE_DONTKNOW )
|
|
|
|
, nFlags(SvxAutoCorrect::GetDefaultFlags())
|
|
|
|
, cStartDQuote( 0 )
|
|
|
|
, cEndDQuote( 0 )
|
|
|
|
, cStartSQuote( 0 )
|
|
|
|
, cEndSQuote( 0 )
|
|
|
|
, cEmDash( 0x2014 )
|
|
|
|
, cEnDash( 0x2013)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxAutoCorrect::SvxAutoCorrect( const SvxAutoCorrect& rCpy )
|
2014-02-05 13:37:06 -06:00
|
|
|
: sShareAutoCorrFile( rCpy.sShareAutoCorrFile )
|
|
|
|
, sUserAutoCorrFile( rCpy.sUserAutoCorrFile )
|
|
|
|
, aSwFlags( rCpy.aSwFlags )
|
2015-07-17 18:19:29 +02:00
|
|
|
, m_pLangTable( new std::map<LanguageTag, std::unique_ptr<SvxAutoCorrectLanguageLists>> )
|
2015-11-10 10:14:16 +01:00
|
|
|
, pCharClass( nullptr )
|
2014-02-05 13:37:06 -06:00
|
|
|
, bRunNext( false )
|
|
|
|
, eCharClassLang(rCpy.eCharClassLang)
|
|
|
|
, nFlags( rCpy.nFlags & ~(ChgWordLstLoad|CplSttLstLoad|WrdSttLstLoad))
|
|
|
|
, cStartDQuote( rCpy.cStartDQuote )
|
|
|
|
, cEndDQuote( rCpy.cEndDQuote )
|
|
|
|
, cStartSQuote( rCpy.cStartSQuote )
|
|
|
|
, cEndSQuote( rCpy.cEndSQuote )
|
|
|
|
, cEmDash( rCpy.cEmDash )
|
|
|
|
, cEnDash( rCpy.cEnDash )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SvxAutoCorrect::~SvxAutoCorrect()
|
|
|
|
{
|
2015-07-17 18:19:29 +02:00
|
|
|
delete m_pLangTable;
|
2000-10-18 10:45:13 +00:00
|
|
|
delete pCharClass;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2016-04-06 12:07:30 +02:00
|
|
|
void SvxAutoCorrect::GetCharClass_( LanguageType eLang )
|
2000-10-18 10:45:13 +00:00
|
|
|
{
|
|
|
|
delete pCharClass;
|
2013-09-21 15:20:49 +02:00
|
|
|
pCharClass = new CharClass( LanguageTag( eLang));
|
2000-10-18 10:45:13 +00:00
|
|
|
eCharClassLang = eLang;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
void SvxAutoCorrect::SetAutoCorrFlag( long nFlag, bool bOn )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
long nOld = nFlags;
|
|
|
|
nFlags = bOn ? nFlags | nFlag
|
|
|
|
: nFlags & ~nFlag;
|
|
|
|
|
|
|
|
if( !bOn )
|
|
|
|
{
|
2015-05-26 09:49:42 +02:00
|
|
|
if( (nOld & CapitalStartSentence) != (nFlags & CapitalStartSentence) )
|
2000-09-18 16:07:07 +00:00
|
|
|
nFlags &= ~CplSttLstLoad;
|
2015-05-26 09:52:08 +02:00
|
|
|
if( (nOld & CapitalStartWord) != (nFlags & CapitalStartWord) )
|
2000-09-18 16:07:07 +00:00
|
|
|
nFlags &= ~WrdSttLstLoad;
|
|
|
|
if( (nOld & Autocorrect) != (nFlags & Autocorrect) )
|
|
|
|
nFlags &= ~ChgWordLstLoad;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Two capital letters at the beginning of word?
|
2015-05-26 09:52:08 +02:00
|
|
|
bool SvxAutoCorrect::FnCapitalStartWord( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 nSttPos, sal_Int32 nEndPos,
|
2000-09-18 16:07:07 +00:00
|
|
|
LanguageType eLang )
|
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bRet = false;
|
2000-10-18 10:45:13 +00:00
|
|
|
CharClass& rCC = GetCharClass( eLang );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Delete all non alphanumeric. Test the characters at the beginning/end of
|
|
|
|
// the word ( recognizes: "(min.", "/min.", and so on.)
|
2000-09-18 16:07:07 +00:00
|
|
|
for( ; nSttPos < nEndPos; ++nSttPos )
|
2000-10-18 10:45:13 +00:00
|
|
|
if( rCC.isLetterNumeric( rTxt, nSttPos ))
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
for( ; nSttPos < nEndPos; --nEndPos )
|
2000-10-18 10:45:13 +00:00
|
|
|
if( rCC.isLetterNumeric( rTxt, nEndPos - 1 ))
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
|
2013-05-15 10:42:04 +03:00
|
|
|
// Is the word a compounded word separated by delimiters?
|
2013-02-23 13:58:18 -05:00
|
|
|
// If so, keep track of all delimiters so each constituent
|
|
|
|
// word can be checked for two initial capital letters.
|
2014-01-15 10:14:52 +00:00
|
|
|
std::deque<sal_Int32> aDelimiters;
|
2013-02-23 13:58:18 -05:00
|
|
|
|
|
|
|
// Always check for two capitals at the beginning
|
|
|
|
// of the entire word, so start at nSttPos.
|
|
|
|
aDelimiters.push_back(nSttPos);
|
|
|
|
|
|
|
|
// Find all compound word delimiters
|
2014-01-15 10:14:52 +00:00
|
|
|
for (sal_Int32 n = nSttPos; n < nEndPos; ++n)
|
2013-02-23 13:58:18 -05:00
|
|
|
{
|
2016-09-21 20:34:32 +01:00
|
|
|
if (IsCompoundWordDelimChar(rTxt[ n ]))
|
2013-02-23 13:58:18 -05:00
|
|
|
{
|
|
|
|
aDelimiters.push_back( n + 1 ); // Get position of char after delimiter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Decide where to put the terminating delimiter.
|
|
|
|
// If the last AutoCorrect char was a newline, then the AutoCorrect
|
|
|
|
// char will not be included in rTxt.
|
|
|
|
// If the last AutoCorrect char was not a newline, then the AutoCorrect
|
|
|
|
// character will be the last character in rTxt.
|
2016-09-21 20:34:32 +01:00
|
|
|
if (!IsCompoundWordDelimChar(rTxt[nEndPos-1]))
|
2013-02-23 13:58:18 -05:00
|
|
|
aDelimiters.push_back(nEndPos);
|
|
|
|
|
|
|
|
// Iterate through the word and all words that compose it.
|
2011-02-16 16:34:02 -05:00
|
|
|
// Two capital letters at the beginning of word?
|
2013-11-08 15:30:40 +00:00
|
|
|
for (size_t nI = 0; nI < aDelimiters.size() - 1; ++nI)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-11-08 15:30:40 +00:00
|
|
|
nSttPos = aDelimiters[nI];
|
|
|
|
nEndPos = aDelimiters[nI + 1];
|
2013-02-23 13:58:18 -05:00
|
|
|
|
|
|
|
if( nSttPos+2 < nEndPos &&
|
|
|
|
IsUpperLetter( rCC.getCharacterType( rTxt, nSttPos )) &&
|
|
|
|
IsUpperLetter( rCC.getCharacterType( rTxt, ++nSttPos )) &&
|
|
|
|
// Is the third character a lower case
|
|
|
|
IsLowerLetter( rCC.getCharacterType( rTxt, nSttPos +1 )) &&
|
|
|
|
// Do not replace special attributes
|
2013-09-16 13:17:09 +02:00
|
|
|
0x1 != rTxt[ nSttPos ] && 0x2 != rTxt[ nSttPos ])
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-02-23 13:58:18 -05:00
|
|
|
// test if the word is in an exception list
|
2013-09-20 13:47:10 +02:00
|
|
|
OUString sWord( rTxt.copy( nSttPos - 1, nEndPos - nSttPos + 1 ));
|
2013-02-23 13:58:18 -05:00
|
|
|
if( !FindInWrdSttExceptList(eLang, sWord) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-02-23 13:58:18 -05:00
|
|
|
// Check that word isn't correctly spelled before correcting:
|
2015-09-11 15:44:09 +02:00
|
|
|
css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpeller =
|
2016-07-10 22:08:12 +02:00
|
|
|
LinguMgr::GetSpellChecker();
|
2013-02-23 13:58:18 -05:00
|
|
|
if( xSpeller->hasLanguage(eLang) )
|
2011-02-22 20:17:59 +01:00
|
|
|
{
|
2015-09-11 15:44:09 +02:00
|
|
|
Sequence< css::beans::PropertyValue > aEmptySeq;
|
2016-11-28 13:01:40 +00:00
|
|
|
if (xSpeller->isValid(sWord, eLang, aEmptySeq))
|
2013-02-23 13:58:18 -05:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2013-09-16 13:17:09 +02:00
|
|
|
sal_Unicode cSave = rTxt[ nSttPos ];
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sChar( cSave );
|
2013-02-23 13:58:18 -05:00
|
|
|
sChar = rCC.lowercase( sChar );
|
|
|
|
if( sChar[0] != cSave && rDoc.ReplaceRange( nSttPos, 1, sChar ))
|
|
|
|
{
|
|
|
|
if( SaveWordWrdSttLst & nFlags )
|
2015-05-26 09:52:08 +02:00
|
|
|
rDoc.SaveCpltSttWord( CapitalStartWord, nSttPos, sWord, cSave );
|
2014-02-26 11:01:45 +02:00
|
|
|
bRet = true;
|
2011-02-22 20:17:59 +01:00
|
|
|
}
|
2012-08-02 17:30:09 +02:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrect::FnChgOrdinalNumber(
|
2015-03-19 20:30:41 +01:00
|
|
|
SvxAutoCorrDoc& rDoc, const OUString& rTxt,
|
|
|
|
sal_Int32 nSttPos, sal_Int32 nEndPos,
|
|
|
|
LanguageType eLang)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-03-19 20:30:41 +01:00
|
|
|
// 1st, 2nd, 3rd, 4 - 0th
|
|
|
|
// 201th or 201st
|
|
|
|
// 12th or 12nd
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bChg = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2015-03-19 20:30:41 +01:00
|
|
|
// In some languages ordinal suffixes should never be
|
|
|
|
// changed to superscript. Let's break for those languages.
|
|
|
|
switch (eLang)
|
|
|
|
{
|
|
|
|
case LANGUAGE_SWEDISH:
|
|
|
|
case LANGUAGE_SWEDISH_FINLAND:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
CharClass& rCC = GetCharClass(eLang);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2015-03-19 20:30:41 +01:00
|
|
|
for (; nSttPos < nEndPos; ++nSttPos)
|
|
|
|
if (!lcl_IsInAsciiArr(sImplSttSkipChars, rTxt[nSttPos]))
|
|
|
|
break;
|
|
|
|
for (; nSttPos < nEndPos; --nEndPos)
|
|
|
|
if (!lcl_IsInAsciiArr(sImplEndSkipChars, rTxt[nEndPos - 1]))
|
|
|
|
break;
|
2011-04-07 13:33:48 +02:00
|
|
|
|
|
|
|
|
2015-03-19 20:30:41 +01:00
|
|
|
// Get the last number in the string to check
|
|
|
|
sal_Int32 nNumEnd = nEndPos;
|
2015-09-25 11:41:53 +01:00
|
|
|
bool bFoundEnd = false;
|
|
|
|
bool isValidNumber = true;
|
2015-03-19 20:30:41 +01:00
|
|
|
sal_Int32 i = nEndPos;
|
|
|
|
while (i > nSttPos)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-03-19 20:30:41 +01:00
|
|
|
i--;
|
|
|
|
bool isDigit = rCC.isDigit(rTxt, i);
|
2015-09-25 11:41:53 +01:00
|
|
|
if (bFoundEnd)
|
2016-08-30 14:38:24 +02:00
|
|
|
isValidNumber &= (isDigit || !rCC.isLetter(rTxt, i));
|
2011-04-07 13:33:48 +02:00
|
|
|
|
2015-09-25 11:41:53 +01:00
|
|
|
if (isDigit && !bFoundEnd)
|
2015-03-19 20:30:41 +01:00
|
|
|
{
|
2015-09-25 11:41:53 +01:00
|
|
|
bFoundEnd = true;
|
2015-03-19 20:30:41 +01:00
|
|
|
nNumEnd = i;
|
|
|
|
}
|
|
|
|
}
|
2011-04-07 13:33:48 +02:00
|
|
|
|
2015-09-25 11:41:53 +01:00
|
|
|
if (bFoundEnd && isValidNumber) {
|
2015-03-19 20:30:41 +01:00
|
|
|
sal_Int32 nNum = rTxt.copy(nSttPos, nNumEnd - nSttPos + 1).toInt32();
|
2011-04-07 13:33:48 +02:00
|
|
|
|
2015-03-19 20:30:41 +01:00
|
|
|
// Check if the characters after that number correspond to the ordinal suffix
|
|
|
|
uno::Reference< i18n::XOrdinalSuffix > xOrdSuffix
|
|
|
|
= i18n::OrdinalSuffix::create(comphelper::getProcessComponentContext());
|
2011-04-07 13:33:48 +02:00
|
|
|
|
2015-03-19 20:30:41 +01:00
|
|
|
uno::Sequence< OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix(nNum, rCC.getLanguageTag().getLocale());
|
|
|
|
for (sal_Int32 nSuff = 0; nSuff < aSuffixes.getLength(); nSuff++)
|
2013-02-01 17:35:50 +02:00
|
|
|
{
|
2015-03-19 20:30:41 +01:00
|
|
|
OUString sSuffix(aSuffixes[nSuff]);
|
|
|
|
OUString sEnd = rTxt.copy(nNumEnd + 1, nEndPos - nNumEnd - 1);
|
|
|
|
|
|
|
|
if (sSuffix == sEnd)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-03-19 20:30:41 +01:00
|
|
|
// Check if the ordinal suffix has to be set as super script
|
|
|
|
if (rCC.isLetter(sSuffix))
|
|
|
|
{
|
|
|
|
// Do the change
|
|
|
|
SvxEscapementItem aSvxEscapementItem(DFLT_ESC_AUTO_SUPER,
|
|
|
|
DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT);
|
|
|
|
rDoc.SetAttr(nNumEnd + 1, nEndPos,
|
|
|
|
SID_ATTR_CHAR_ESCAPEMENT,
|
|
|
|
aSvxEscapementItem);
|
|
|
|
bChg = true;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bChg;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrect::FnChgToEnEmDash(
|
2013-09-16 13:17:09 +02:00
|
|
|
SvxAutoCorrDoc& rDoc, const OUString& rTxt,
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 nSttPos, sal_Int32 nEndPos,
|
2000-10-18 10:45:13 +00:00
|
|
|
LanguageType eLang )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bRet = false;
|
2000-10-18 10:45:13 +00:00
|
|
|
CharClass& rCC = GetCharClass( eLang );
|
2007-05-29 14:46:57 +00:00
|
|
|
if (eLang == LANGUAGE_SYSTEM)
|
2012-11-24 18:54:09 +01:00
|
|
|
eLang = GetAppLang().getLanguageType();
|
2007-05-29 14:46:57 +00:00
|
|
|
bool bAlwaysUseEmDash = (cEmDash && (eLang == LANGUAGE_RUSSIAN || eLang == LANGUAGE_UKRAINIAN));
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// replace " - " or " --" with "enDash"
|
2000-09-18 16:07:07 +00:00
|
|
|
if( cEnDash && 1 < nSttPos && 1 <= nEndPos - nSttPos )
|
|
|
|
{
|
2013-09-16 13:17:09 +02:00
|
|
|
sal_Unicode cCh = rTxt[ nSttPos ];
|
2000-09-18 16:07:07 +00:00
|
|
|
if( '-' == cCh )
|
|
|
|
{
|
2013-09-16 13:17:09 +02:00
|
|
|
if( ' ' == rTxt[ nSttPos-1 ] &&
|
|
|
|
'-' == rTxt[ nSttPos+1 ])
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 n;
|
2000-09-18 16:07:07 +00:00
|
|
|
for( n = nSttPos+2; n < nEndPos && lcl_IsInAsciiArr(
|
2013-09-16 13:17:09 +02:00
|
|
|
sImplSttSkipChars,(cCh = rTxt[ n ]));
|
2000-09-18 16:07:07 +00:00
|
|
|
++n )
|
|
|
|
;
|
|
|
|
|
|
|
|
// found: " --[<AnySttChars>][A-z0-9]
|
2013-04-07 12:06:47 +02:00
|
|
|
if( rCC.isLetterNumeric( OUString(cCh) ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
for( n = nSttPos-1; n && lcl_IsInAsciiArr(
|
2013-09-16 13:17:09 +02:00
|
|
|
sImplEndSkipChars,(cCh = rTxt[ --n ])); )
|
2000-09-18 16:07:07 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
// found: "[A-z0-9][<AnyEndChars>] --[<AnySttChars>][A-z0-9]
|
2013-04-07 12:06:47 +02:00
|
|
|
if( rCC.isLetterNumeric( OUString(cCh) ))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
rDoc.Delete( nSttPos, nSttPos + 2 );
|
2013-04-07 12:06:47 +02:00
|
|
|
rDoc.Insert( nSttPos, bAlwaysUseEmDash ? OUString(cEmDash) : OUString(cEnDash) );
|
2014-02-26 11:01:45 +02:00
|
|
|
bRet = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( 3 < nSttPos &&
|
2013-09-16 13:17:09 +02:00
|
|
|
' ' == rTxt[ nSttPos-1 ] &&
|
|
|
|
'-' == rTxt[ nSttPos-2 ])
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 n, nLen = 1, nTmpPos = nSttPos - 2;
|
2013-09-16 13:17:09 +02:00
|
|
|
if( '-' == ( cCh = rTxt[ nTmpPos-1 ]) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
--nTmpPos;
|
|
|
|
++nLen;
|
2013-09-16 13:17:09 +02:00
|
|
|
cCh = rTxt[ nTmpPos-1 ];
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
if( ' ' == cCh )
|
|
|
|
{
|
|
|
|
for( n = nSttPos; n < nEndPos && lcl_IsInAsciiArr(
|
2013-09-16 13:17:09 +02:00
|
|
|
sImplSttSkipChars,(cCh = rTxt[ n ]));
|
2000-09-18 16:07:07 +00:00
|
|
|
++n )
|
|
|
|
;
|
|
|
|
|
|
|
|
// found: " - [<AnySttChars>][A-z0-9]
|
2013-04-07 12:06:47 +02:00
|
|
|
if( rCC.isLetterNumeric( OUString(cCh) ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
cCh = ' ';
|
|
|
|
for( n = nTmpPos-1; n && lcl_IsInAsciiArr(
|
2013-09-16 13:17:09 +02:00
|
|
|
sImplEndSkipChars,(cCh = rTxt[ --n ])); )
|
2000-09-18 16:07:07 +00:00
|
|
|
;
|
|
|
|
// found: "[A-z0-9][<AnyEndChars>] - [<AnySttChars>][A-z0-9]
|
2013-04-07 12:06:47 +02:00
|
|
|
if( rCC.isLetterNumeric( OUString(cCh) ))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
rDoc.Delete( nTmpPos, nTmpPos + nLen );
|
2013-04-07 12:06:47 +02:00
|
|
|
rDoc.Insert( nTmpPos, bAlwaysUseEmDash ? OUString(cEmDash) : OUString(cEnDash) );
|
2014-02-26 11:01:45 +02:00
|
|
|
bRet = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-29 13:01:55 +02:00
|
|
|
// Replace [A-z0-9]--[A-z0-9] double dash with "emDash" or "enDash"
|
|
|
|
// [0-9]--[0-9] double dash always replaced with "enDash"
|
2006-12-19 17:03:23 +00:00
|
|
|
// Finnish and Hungarian use enDash instead of emDash.
|
2007-05-29 14:46:57 +00:00
|
|
|
bool bEnDash = (eLang == LANGUAGE_HUNGARIAN || eLang == LANGUAGE_FINNISH);
|
2006-12-19 17:03:23 +00:00
|
|
|
if( ((cEmDash && !bEnDash) || (cEnDash && bEnDash)) && 4 <= nEndPos - nSttPos )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-09-30 11:03:58 +01:00
|
|
|
OUString sTmp( rTxt.copy( nSttPos, nEndPos - nSttPos ) );
|
|
|
|
sal_Int32 nFndPos = sTmp.indexOf("--");
|
|
|
|
if( nFndPos != -1 && nFndPos &&
|
|
|
|
nFndPos + 2 < sTmp.getLength() &&
|
2000-10-18 10:45:13 +00:00
|
|
|
( rCC.isLetterNumeric( sTmp, nFndPos - 1 ) ||
|
2013-09-16 13:17:09 +02:00
|
|
|
lcl_IsInAsciiArr( sImplEndSkipChars, rTxt[ nFndPos - 1 ] )) &&
|
2000-10-18 10:45:13 +00:00
|
|
|
( rCC.isLetterNumeric( sTmp, nFndPos + 2 ) ||
|
2013-09-16 13:17:09 +02:00
|
|
|
lcl_IsInAsciiArr( sImplSttSkipChars, rTxt[ nFndPos + 2 ] )))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-10-12 11:40:24 +00:00
|
|
|
nSttPos = nSttPos + nFndPos;
|
2000-09-18 16:07:07 +00:00
|
|
|
rDoc.Delete( nSttPos, nSttPos + 2 );
|
2014-08-29 13:01:55 +02:00
|
|
|
rDoc.Insert( nSttPos, (bEnDash || (rCC.isDigit( sTmp, nFndPos - 1 ) &&
|
|
|
|
rCC.isDigit( sTmp, nFndPos + 2 )) ? OUString(cEnDash) : OUString(cEmDash)) );
|
2014-02-26 11:01:45 +02:00
|
|
|
bRet = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2011-10-06 16:10:32 +03:00
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrect::FnAddNonBrkSpace(
|
2013-09-16 13:17:09 +02:00
|
|
|
SvxAutoCorrDoc& rDoc, const OUString& rTxt,
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32, sal_Int32 nEndPos,
|
2009-11-16 16:49:18 +01:00
|
|
|
LanguageType eLang )
|
|
|
|
{
|
|
|
|
bool bRet = false;
|
|
|
|
|
|
|
|
CharClass& rCC = GetCharClass( eLang );
|
|
|
|
|
2013-07-10 21:20:05 +02:00
|
|
|
if ( rCC.getLanguageTag().getLanguage() == "fr" )
|
2009-11-16 16:49:18 +01:00
|
|
|
{
|
2013-07-10 21:20:05 +02:00
|
|
|
bool bFrCA = (rCC.getLanguageTag().getCountry() == "CA");
|
2013-11-15 11:05:19 +02:00
|
|
|
OUString allChars = ":;?!%";
|
2010-01-18 09:53:04 +01:00
|
|
|
OUString chars( allChars );
|
|
|
|
if ( bFrCA )
|
2013-11-15 11:05:19 +02:00
|
|
|
chars = ":";
|
2009-11-16 16:49:18 +01:00
|
|
|
|
2013-09-16 13:17:09 +02:00
|
|
|
sal_Unicode cChar = rTxt[ nEndPos ];
|
2010-09-24 10:40:39 +02:00
|
|
|
bool bHasSpace = chars.indexOf( cChar ) != -1;
|
|
|
|
bool bIsSpecial = allChars.indexOf( cChar ) != -1;
|
2010-01-18 09:53:04 +01:00
|
|
|
if ( bIsSpecial )
|
2009-11-16 16:49:18 +01:00
|
|
|
{
|
2010-01-22 13:43:58 +01:00
|
|
|
// Get the last word delimiter position
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 nSttWdPos = nEndPos;
|
2011-02-21 00:38:25 +01:00
|
|
|
bool bWasWordDelim = false;
|
2013-09-16 13:17:09 +02:00
|
|
|
while( nSttWdPos && !(bWasWordDelim = IsWordDelim( rTxt[ --nSttWdPos ])))
|
2010-01-22 13:43:58 +01:00
|
|
|
;
|
|
|
|
|
2013-09-18 13:34:35 +01:00
|
|
|
//See if the text is the start of a protocol string, e.g. have text of
|
|
|
|
//"http" see if it is the start of "http:" and if so leave it alone
|
|
|
|
sal_Int32 nIndex = nSttWdPos + (bWasWordDelim ? 1 : 0);
|
|
|
|
sal_Int32 nProtocolLen = nEndPos - nSttWdPos + 1;
|
|
|
|
if (nIndex + nProtocolLen <= rTxt.getLength())
|
|
|
|
{
|
2015-04-02 18:32:36 +02:00
|
|
|
if (INetURLObject::CompareProtocolScheme(rTxt.copy(nIndex, nProtocolLen)) != INetProtocol::NotValid)
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2011-02-21 00:38:25 +01:00
|
|
|
}
|
|
|
|
|
2010-01-22 13:43:58 +01:00
|
|
|
// Check the presence of "://" in the word
|
2013-09-18 13:44:24 +01:00
|
|
|
sal_Int32 nStrPos = rTxt.indexOf( "://", nSttWdPos + 1 );
|
|
|
|
if ( nStrPos == -1 && nEndPos > 0 )
|
2009-11-16 16:49:18 +01:00
|
|
|
{
|
2010-01-22 13:43:58 +01:00
|
|
|
// Check the previous char
|
2013-09-16 13:17:09 +02:00
|
|
|
sal_Unicode cPrevChar = rTxt[ nEndPos - 1 ];
|
2010-09-24 10:40:39 +02:00
|
|
|
if ( ( chars.indexOf( cPrevChar ) == -1 ) && cPrevChar != '\t' )
|
2009-11-16 16:49:18 +01:00
|
|
|
{
|
2010-01-22 13:43:58 +01:00
|
|
|
// Remove any previous normal space
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 nPos = nEndPos - 1;
|
2013-09-22 00:19:12 +02:00
|
|
|
while ( cPrevChar == ' ' || cPrevChar == cNonBreakingSpace )
|
2010-01-22 13:43:58 +01:00
|
|
|
{
|
|
|
|
if ( nPos == 0 ) break;
|
|
|
|
nPos--;
|
2013-09-16 13:17:09 +02:00
|
|
|
cPrevChar = rTxt[ nPos ];
|
2010-01-22 13:43:58 +01:00
|
|
|
}
|
2009-11-16 16:49:18 +01:00
|
|
|
|
2010-09-24 10:40:39 +02:00
|
|
|
nPos++;
|
|
|
|
if ( nEndPos - nPos > 0 )
|
|
|
|
rDoc.Delete( nPos, nEndPos );
|
|
|
|
|
|
|
|
// Add the non-breaking space at the end pos
|
|
|
|
if ( bHasSpace )
|
2013-09-22 00:19:12 +02:00
|
|
|
rDoc.Insert( nPos, OUString(cNonBreakingSpace) );
|
2010-09-24 10:40:39 +02:00
|
|
|
bRunNext = true;
|
|
|
|
bRet = true;
|
2009-11-16 16:49:18 +01:00
|
|
|
}
|
2010-09-24 10:40:39 +02:00
|
|
|
else if ( chars.indexOf( cPrevChar ) != -1 )
|
2010-03-16 11:50:00 +01:00
|
|
|
bRunNext = true;
|
2009-11-16 16:49:18 +01:00
|
|
|
}
|
|
|
|
}
|
2013-09-16 13:17:09 +02:00
|
|
|
else if ( cChar == '/' && nEndPos > 1 && rTxt.getLength() > (nEndPos - 1) )
|
2010-01-21 13:58:49 +01:00
|
|
|
{
|
|
|
|
// Remove the hardspace right before to avoid formatting URLs
|
2013-09-16 13:17:09 +02:00
|
|
|
sal_Unicode cPrevChar = rTxt[ nEndPos - 1 ];
|
|
|
|
sal_Unicode cMaybeSpaceChar = rTxt[ nEndPos - 2 ];
|
2013-09-22 00:19:12 +02:00
|
|
|
if ( cPrevChar == ':' && cMaybeSpaceChar == cNonBreakingSpace )
|
2010-01-21 13:58:49 +01:00
|
|
|
{
|
|
|
|
rDoc.Delete( nEndPos - 2, nEndPos - 1 );
|
|
|
|
bRet = true;
|
|
|
|
}
|
|
|
|
}
|
2009-11-16 16:49:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-10-06 16:10:32 +03:00
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrect::FnSetINetAttr( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 nSttPos, sal_Int32 nEndPos,
|
2000-10-18 10:45:13 +00:00
|
|
|
LanguageType eLang )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-01-15 10:14:52 +00:00
|
|
|
OUString sURL( URIHelper::FindFirstURLInText( rTxt, nSttPos, nEndPos,
|
2000-10-18 10:45:13 +00:00
|
|
|
GetCharClass( eLang ) ));
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bRet = !sURL.isEmpty();
|
2000-09-18 16:07:07 +00:00
|
|
|
if( bRet ) // also Attribut setzen:
|
|
|
|
rDoc.SetINetAttr( nSttPos, nEndPos, sURL );
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
|
2016-03-03 08:56:35 +02:00
|
|
|
sal_Int32 , sal_Int32 nEndPos )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// Condition:
|
2016-11-22 14:41:33 +00:00
|
|
|
// at the beginning: _, *, / or ~ after Space with the following !Space
|
|
|
|
// at the end: _, *, / or ~ before Space (word delimiter?)
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2016-11-22 14:41:33 +00:00
|
|
|
sal_Unicode cInsChar = rTxt[ nEndPos ]; // underline, bold, italic or strikeout
|
2013-09-16 13:17:09 +02:00
|
|
|
if( ++nEndPos != rTxt.getLength() &&
|
|
|
|
!IsWordDelim( rTxt[ nEndPos ] ) )
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
--nEndPos;
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bAlphaNum = false;
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 nPos = nEndPos;
|
2013-09-20 13:47:10 +02:00
|
|
|
sal_Int32 nFndPos = -1;
|
2016-03-03 08:56:35 +02:00
|
|
|
CharClass& rCC = GetCharClass( LANGUAGE_SYSTEM );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
while( nPos )
|
|
|
|
{
|
2015-10-07 10:15:29 +02:00
|
|
|
switch( sal_Unicode c = rTxt[ --nPos ] )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
case '_':
|
2016-11-22 14:41:33 +00:00
|
|
|
case '-':
|
|
|
|
case '/':
|
2000-09-18 16:07:07 +00:00
|
|
|
case '*':
|
|
|
|
if( c == cInsChar )
|
|
|
|
{
|
|
|
|
if( bAlphaNum && nPos+1 < nEndPos && ( !nPos ||
|
2013-09-16 13:17:09 +02:00
|
|
|
IsWordDelim( rTxt[ nPos-1 ])) &&
|
|
|
|
!IsWordDelim( rTxt[ nPos+1 ]))
|
2000-09-18 16:07:07 +00:00
|
|
|
nFndPos = nPos;
|
|
|
|
else
|
2011-02-16 16:34:02 -05:00
|
|
|
// Condition is not satisfied, so cancel
|
2013-09-20 13:47:10 +02:00
|
|
|
nFndPos = -1;
|
2000-09-18 16:07:07 +00:00
|
|
|
nPos = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if( !bAlphaNum )
|
2000-10-18 10:45:13 +00:00
|
|
|
bAlphaNum = rCC.isLetterNumeric( rTxt, nPos );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-20 13:47:10 +02:00
|
|
|
if( -1 != nFndPos )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-06-20 00:20:52 +02:00
|
|
|
// first delete the Character at the end - this allows insertion
|
|
|
|
// of an empty hint in SetAttr which would be removed by Delete
|
|
|
|
// (fdo#62536, AUTOFMT in Writer)
|
|
|
|
rDoc.Delete( nEndPos, nEndPos + 1 );
|
|
|
|
rDoc.Delete( nFndPos, nFndPos + 1 );
|
|
|
|
// Span the Attribute over the area
|
2011-02-16 16:34:02 -05:00
|
|
|
// the end.
|
|
|
|
if( '*' == cInsChar ) // Bold
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2007-05-10 13:46:42 +00:00
|
|
|
SvxWeightItem aSvxWeightItem( WEIGHT_BOLD, SID_ATTR_CHAR_WEIGHT );
|
2013-06-20 00:20:52 +02:00
|
|
|
rDoc.SetAttr( nFndPos, nEndPos - 1,
|
2016-11-22 14:41:33 +00:00
|
|
|
SID_ATTR_CHAR_WEIGHT,
|
|
|
|
aSvxWeightItem);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2016-11-22 14:41:33 +00:00
|
|
|
else if( '/' == cInsChar ) // Italic
|
|
|
|
{
|
|
|
|
SvxPostureItem aSvxPostureItem( ITALIC_NORMAL, SID_ATTR_CHAR_POSTURE );
|
|
|
|
rDoc.SetAttr( nFndPos, nEndPos - 1,
|
|
|
|
SID_ATTR_CHAR_POSTURE,
|
|
|
|
aSvxPostureItem);
|
|
|
|
}
|
|
|
|
else if( '-' == cInsChar ) // Strikeout
|
|
|
|
{
|
|
|
|
SvxCrossedOutItem aSvxCrossedOutItem( STRIKEOUT_SINGLE, SID_ATTR_CHAR_STRIKEOUT );
|
|
|
|
rDoc.SetAttr( nFndPos, nEndPos - 1,
|
|
|
|
SID_ATTR_CHAR_STRIKEOUT,
|
|
|
|
aSvxCrossedOutItem);
|
|
|
|
}
|
|
|
|
else // Underline
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2016-01-29 17:43:42 +11:00
|
|
|
SvxUnderlineItem aSvxUnderlineItem( LINESTYLE_SINGLE, SID_ATTR_CHAR_UNDERLINE );
|
2013-06-20 00:20:52 +02:00
|
|
|
rDoc.SetAttr( nFndPos, nEndPos - 1,
|
2016-11-22 14:41:33 +00:00
|
|
|
SID_ATTR_CHAR_UNDERLINE,
|
|
|
|
aSvxUnderlineItem);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2016-11-22 14:41:33 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-09-20 13:47:10 +02:00
|
|
|
return -1 != nFndPos;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-26 09:49:42 +02:00
|
|
|
bool SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc,
|
2014-02-26 11:01:45 +02:00
|
|
|
const OUString& rTxt, bool bNormalPos,
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 nSttPos, sal_Int32 nEndPos,
|
2000-09-18 16:07:07 +00:00
|
|
|
LanguageType eLang )
|
|
|
|
{
|
2011-02-21 00:38:25 +01:00
|
|
|
|
2013-09-16 13:17:09 +02:00
|
|
|
if( rTxt.isEmpty() || nEndPos <= nSttPos )
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-21 00:38:25 +01:00
|
|
|
CharClass& rCC = GetCharClass( eLang );
|
2013-09-20 13:47:10 +02:00
|
|
|
OUString aText( rTxt );
|
|
|
|
const sal_Unicode *pStart = aText.getStr(),
|
2000-09-18 16:07:07 +00:00
|
|
|
*pStr = pStart + nEndPos,
|
2015-11-10 10:14:16 +01:00
|
|
|
*pWordStt = nullptr,
|
|
|
|
*pDelim = nullptr;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bAtStart = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
do {
|
|
|
|
--pStr;
|
2014-01-15 10:14:52 +00:00
|
|
|
if (rCC.isLetter(aText, pStr - pStart))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if( !pWordStt )
|
|
|
|
pDelim = pStr+1;
|
|
|
|
pWordStt = pStr;
|
|
|
|
}
|
2014-01-15 10:14:52 +00:00
|
|
|
else if (pWordStt && !rCC.isDigit(aText, pStr - pStart))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2016-11-04 12:28:59 +02:00
|
|
|
if( lcl_IsInAsciiArr( "-'", *pStr ) && // These characters are allowed in words
|
2000-09-18 16:07:07 +00:00
|
|
|
pWordStt - 1 == pStr &&
|
2011-02-16 16:34:02 -05:00
|
|
|
// Installation at beginning of paragraph. Replaced < by <= (#i38971#)
|
2014-09-30 09:02:35 +02:00
|
|
|
(pStart + 1) <= pStr &&
|
2014-01-15 10:14:52 +00:00
|
|
|
rCC.isLetter(aText, pStr-1 - pStart))
|
2000-09-18 16:07:07 +00:00
|
|
|
pWordStt = --pStr;
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
2016-11-29 17:21:18 +01:00
|
|
|
bAtStart = (pStart == pStr);
|
|
|
|
} while( !bAtStart );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-09-17 14:38:42 +01:00
|
|
|
if (!pWordStt)
|
2014-02-26 11:01:45 +02:00
|
|
|
return false; // no character to be replaced
|
2013-09-17 14:38:42 +01:00
|
|
|
|
|
|
|
|
2014-01-15 10:14:52 +00:00
|
|
|
if (rCC.isDigit(aText, pStr - pStart))
|
2014-02-26 11:01:45 +02:00
|
|
|
return false; // already ok
|
2013-09-17 14:38:42 +01:00
|
|
|
|
2014-01-15 10:14:52 +00:00
|
|
|
if (IsUpperLetter(rCC.getCharacterType(aText, pWordStt - pStart)))
|
2014-02-26 11:01:45 +02:00
|
|
|
return false; // already ok
|
2013-09-17 14:38:42 +01:00
|
|
|
|
2013-09-17 14:46:05 +01:00
|
|
|
//See if the text is the start of a protocol string, e.g. have text of
|
|
|
|
//"http" see if it is the start of "http:" and if so leave it alone
|
|
|
|
sal_Int32 nIndex = pWordStt - pStart;
|
|
|
|
sal_Int32 nProtocolLen = pDelim - pWordStt + 1;
|
|
|
|
if (nIndex + nProtocolLen <= rTxt.getLength())
|
|
|
|
{
|
2015-04-02 18:32:36 +02:00
|
|
|
if (INetURLObject::CompareProtocolScheme(rTxt.copy(nIndex, nProtocolLen)) != INetProtocol::NotValid)
|
2014-02-26 11:01:45 +02:00
|
|
|
return false; // already ok
|
2013-09-17 14:46:05 +01:00
|
|
|
}
|
2013-09-17 14:38:42 +01:00
|
|
|
|
|
|
|
if (0x1 == *pWordStt || 0x2 == *pWordStt)
|
2014-02-26 11:01:45 +02:00
|
|
|
return false; // already ok
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( *pDelim && 2 >= pDelim - pWordStt &&
|
|
|
|
lcl_IsInAsciiArr( ".-)>", *pDelim ) )
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
if( !bAtStart ) // Still no beginning of a paragraph?
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2016-07-01 14:38:54 +01:00
|
|
|
if (IsAutoCapitalizeWordDelim(*pStr))
|
2002-08-14 12:36:50 +00:00
|
|
|
{
|
2016-07-01 14:38:54 +01:00
|
|
|
while (!(bAtStart = (pStart == pStr--)) && IsAutoCapitalizeWordDelim(*pStr))
|
2002-08-14 12:36:50 +00:00
|
|
|
;
|
|
|
|
}
|
|
|
|
// Asian full stop, full width full stop, full width exclamation mark
|
|
|
|
// and full width question marks are treated as word delimiters
|
|
|
|
else if ( 0x3002 != *pStr && 0xFF0E != *pStr && 0xFF01 != *pStr &&
|
|
|
|
0xFF1F != *pStr )
|
2014-02-26 11:01:45 +02:00
|
|
|
return false; // no valid separator -> no replacement
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
if( bAtStart ) // at the beginning of a paragraph?
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// Check out the previous paragraph, if it exists.
|
|
|
|
// If so, then check to paragraph separator at the end.
|
2014-02-08 00:23:10 +01:00
|
|
|
OUString const*const pPrevPara = rDoc.GetPrevPara(bNormalPos);
|
|
|
|
if (!pPrevPara)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// valid separator -> replace
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sChar( *pWordStt );
|
2012-11-28 13:36:47 +00:00
|
|
|
sChar = rCC.titlecase(sChar); //see fdo#56740
|
2012-07-04 23:58:05 +01:00
|
|
|
return !comphelper::string::equals(sChar, *pWordStt) &&
|
2014-01-15 10:14:52 +00:00
|
|
|
rDoc.ReplaceRange( pWordStt - pStart, 1, sChar );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-02-08 00:23:10 +01:00
|
|
|
aText = *pPrevPara;
|
2014-02-26 11:01:45 +02:00
|
|
|
bAtStart = false;
|
2013-09-20 13:47:10 +02:00
|
|
|
pStart = aText.getStr();
|
|
|
|
pStr = pStart + aText.getLength();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
do { // overwrite all blanks
|
2000-09-18 16:07:07 +00:00
|
|
|
--pStr;
|
2016-07-01 14:38:54 +01:00
|
|
|
if (!IsAutoCapitalizeWordDelim(*pStr))
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
2016-11-29 17:21:18 +01:00
|
|
|
bAtStart = (pStart == pStr);
|
|
|
|
} while( !bAtStart );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( bAtStart )
|
2014-02-26 11:01:45 +02:00
|
|
|
return false; // no valid separator -> no replacement
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Found [ \t]+[A-Z0-9]+ until here. Test now on the paragraph separator.
|
|
|
|
// all three can happen, but not more than once!
|
2015-11-10 10:14:16 +01:00
|
|
|
const sal_Unicode* pExceptStt = nullptr;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( !bAtStart )
|
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bContinue = true;
|
2016-09-21 16:09:53 +02:00
|
|
|
Flags nFlag = Flags::NONE;
|
2000-09-18 16:07:07 +00:00
|
|
|
do {
|
|
|
|
switch( *pStr )
|
|
|
|
{
|
2002-08-14 12:36:50 +00:00
|
|
|
// Western and Asian full stop
|
2000-09-18 16:07:07 +00:00
|
|
|
case '.':
|
2002-08-14 12:36:50 +00:00
|
|
|
case 0x3002 :
|
|
|
|
case 0xFF0E :
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-04-20 03:15:55 +05:30
|
|
|
if (pStr >= pStart + 2 && *(pStr-2) == '.')
|
|
|
|
{
|
|
|
|
//e.g. text "f.o.o. word": Now currently considering
|
|
|
|
//capitalizing word but second last character of
|
|
|
|
//previous word is a . So probably last word is an
|
|
|
|
//anagram that ends in . and not truly the end of a
|
|
|
|
//previous sentence, so don't autocapitalize this word
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2013-04-20 03:15:55 +05:30
|
|
|
}
|
2016-09-21 16:09:53 +02:00
|
|
|
if( nFlag & Flags::FullStop )
|
2014-02-26 11:01:45 +02:00
|
|
|
return false; // no valid separator -> no replacement
|
2016-09-21 16:09:53 +02:00
|
|
|
nFlag |= Flags::FullStop;
|
2000-09-18 16:07:07 +00:00
|
|
|
pExceptStt = pStr;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case '!':
|
2002-08-14 12:36:50 +00:00
|
|
|
case 0xFF01 :
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2016-09-21 16:09:53 +02:00
|
|
|
if( nFlag & Flags::ExclamationMark )
|
2014-02-26 11:01:45 +02:00
|
|
|
return false; // no valid separator -> no replacement
|
2016-09-21 16:09:53 +02:00
|
|
|
nFlag |= Flags::ExclamationMark;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case '?':
|
2002-08-14 12:36:50 +00:00
|
|
|
case 0xFF1F :
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2016-09-21 16:09:53 +02:00
|
|
|
if( nFlag & Flags::QuestionMark)
|
2014-02-26 11:01:45 +02:00
|
|
|
return false; // no valid separator -> no replacement
|
2016-09-21 16:09:53 +02:00
|
|
|
nFlag |= Flags::QuestionMark;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2016-09-21 16:09:53 +02:00
|
|
|
if( nFlag == Flags::NONE )
|
2014-02-26 11:01:45 +02:00
|
|
|
return false; // no valid separator -> no replacement
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2014-02-26 11:01:45 +02:00
|
|
|
bContinue = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-09-26 19:22:14 +02:00
|
|
|
if( bContinue && pStr-- == pStart )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
return false; // no valid separator -> no replacement
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2013-09-26 19:22:14 +02:00
|
|
|
} while( bContinue );
|
2016-09-21 16:09:53 +02:00
|
|
|
if( Flags::FullStop != nFlag )
|
2015-11-10 10:14:16 +01:00
|
|
|
pExceptStt = nullptr;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( 2 > ( pStr - pStart ) )
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-01-15 10:14:52 +00:00
|
|
|
if (!rCC.isLetterNumeric(aText, pStr-- - pStart))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bValid = false, bAlphaFnd = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
const sal_Unicode* pTmpStr = pStr;
|
|
|
|
while( !bValid )
|
|
|
|
{
|
2014-01-15 10:14:52 +00:00
|
|
|
if( rCC.isDigit( aText, pTmpStr - pStart ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
bValid = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
pStr = pTmpStr - 1;
|
|
|
|
}
|
2014-01-15 10:14:52 +00:00
|
|
|
else if( rCC.isLetter( aText, pTmpStr - pStart ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if( bAlphaFnd )
|
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
bValid = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
pStr = pTmpStr;
|
|
|
|
}
|
|
|
|
else
|
2014-02-26 11:01:45 +02:00
|
|
|
bAlphaFnd = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2016-07-01 14:38:54 +01:00
|
|
|
else if (bAlphaFnd || IsAutoCapitalizeWordDelim(*pTmpStr))
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
if( pTmpStr == pStart )
|
|
|
|
break;
|
|
|
|
|
|
|
|
--pTmpStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !bValid )
|
2014-02-26 11:01:45 +02:00
|
|
|
return false; // no valid separator -> no replacement
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bNumericOnly = '0' <= *(pStr+1) && *(pStr+1) <= '9';
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Search for the beginning of the word
|
2016-07-01 14:38:54 +01:00
|
|
|
while (!IsAutoCapitalizeWordDelim(*pStr))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-01-15 10:14:52 +00:00
|
|
|
if( bNumericOnly && rCC.isLetter( aText, pStr - pStart ) )
|
2014-02-26 11:01:45 +02:00
|
|
|
bNumericOnly = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( pStart == pStr )
|
|
|
|
break;
|
|
|
|
|
|
|
|
--pStr;
|
|
|
|
}
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
if( bNumericOnly ) // consists of only numbers, then not
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2016-07-01 14:38:54 +01:00
|
|
|
if (IsAutoCapitalizeWordDelim(*pStr))
|
2000-09-18 16:07:07 +00:00
|
|
|
++pStr;
|
|
|
|
|
2013-09-20 13:47:10 +02:00
|
|
|
OUString sWord;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// check on the basis of the exception list
|
2000-09-18 16:07:07 +00:00
|
|
|
if( pExceptStt )
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
sWord = OUString(pStr, pExceptStt - pStr + 1);
|
2000-09-18 16:07:07 +00:00
|
|
|
if( FindInCplSttExceptList(eLang, sWord) )
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Delete all non alphanumeric. Test the characters at the
|
|
|
|
// beginning/end of the word ( recognizes: "(min.", "/min.", and so on.)
|
2013-09-20 13:47:10 +02:00
|
|
|
OUString sTmp( sWord );
|
|
|
|
while( !sTmp.isEmpty() &&
|
2000-10-18 10:45:13 +00:00
|
|
|
!rCC.isLetterNumeric( sTmp, 0 ) )
|
2013-09-20 13:47:10 +02:00
|
|
|
sTmp = sTmp.copy(1);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Remove all non alphanumeric characters towards the end up until
|
|
|
|
// the last one.
|
2013-10-28 15:41:25 +02:00
|
|
|
sal_Int32 nLen = sTmp.getLength();
|
2000-10-18 10:45:13 +00:00
|
|
|
while( nLen && !rCC.isLetterNumeric( sTmp, nLen-1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
--nLen;
|
2013-09-20 13:47:10 +02:00
|
|
|
if( nLen + 1 < sTmp.getLength() )
|
|
|
|
sTmp = sTmp.copy( 0, nLen + 1 );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-09-20 13:47:10 +02:00
|
|
|
if( !sTmp.isEmpty() && sTmp.getLength() != sWord.getLength() &&
|
2000-09-18 16:07:07 +00:00
|
|
|
FindInCplSttExceptList(eLang, sTmp))
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
if(FindInCplSttExceptList(eLang, sWord, true))
|
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Ok, then replace
|
2000-09-18 16:07:07 +00:00
|
|
|
sal_Unicode cSave = *pWordStt;
|
2014-01-15 10:14:52 +00:00
|
|
|
nSttPos = pWordStt - rTxt.getStr();
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sChar( cSave );
|
2012-11-28 13:36:47 +00:00
|
|
|
sChar = rCC.titlecase(sChar); //see fdo#56740
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bRet = sChar[0] != cSave && rDoc.ReplaceRange( nSttPos, 1, sChar );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2015-09-29 17:50:10 +02:00
|
|
|
// Perhaps someone wants to have the word
|
2000-09-18 16:07:07 +00:00
|
|
|
if( bRet && SaveWordCplSttLst & nFlags )
|
2015-05-26 09:49:42 +02:00
|
|
|
rDoc.SaveCpltSttWord( CapitalStartSentence, nSttPos, sWord, cSave );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
2010-09-29 16:20:12 -04:00
|
|
|
|
2013-09-16 13:17:09 +02:00
|
|
|
bool SvxAutoCorrect::FnCorrectCapsLock( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 nSttPos, sal_Int32 nEndPos,
|
2010-09-29 16:20:12 -04:00
|
|
|
LanguageType eLang )
|
|
|
|
{
|
|
|
|
if (nEndPos - nSttPos < 2)
|
|
|
|
// string must be at least 2-character long.
|
|
|
|
return false;
|
|
|
|
|
|
|
|
CharClass& rCC = GetCharClass( eLang );
|
|
|
|
|
|
|
|
// Check the first 2 letters.
|
|
|
|
if ( !IsLowerLetter(rCC.getCharacterType(rTxt, nSttPos)) )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if ( !IsUpperLetter(rCC.getCharacterType(rTxt, nSttPos+1)) )
|
|
|
|
return false;
|
|
|
|
|
2013-09-20 13:47:10 +02:00
|
|
|
OUString aConverted;
|
|
|
|
aConverted += rCC.uppercase(OUString(rTxt[nSttPos]));
|
|
|
|
aConverted += rCC.lowercase(OUString(rTxt[nSttPos+1]));
|
2010-09-29 16:20:12 -04:00
|
|
|
|
2013-10-28 12:21:40 +02:00
|
|
|
for( sal_Int32 i = nSttPos+2; i < nEndPos; ++i )
|
2010-09-29 16:20:12 -04:00
|
|
|
{
|
|
|
|
if ( IsLowerLetter(rCC.getCharacterType(rTxt, i)) )
|
|
|
|
// A lowercase letter disqualifies the whole text.
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if ( IsUpperLetter(rCC.getCharacterType(rTxt, i)) )
|
|
|
|
// Another uppercase letter. Convert it.
|
2013-09-20 13:47:10 +02:00
|
|
|
aConverted += rCC.lowercase(OUString(rTxt[i]));
|
2010-09-29 16:20:12 -04:00
|
|
|
else
|
|
|
|
// This is not an alphabetic letter. Leave it as-is.
|
2016-08-30 15:27:48 +02:00
|
|
|
aConverted += OUStringLiteral1( rTxt[i] );
|
2010-09-29 16:20:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Replace the word.
|
|
|
|
rDoc.Delete(nSttPos, nEndPos);
|
|
|
|
rDoc.Insert(nSttPos, aConverted);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-10-19 23:45:24 -05:00
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
sal_Unicode SvxAutoCorrect::GetQuote( sal_Unicode cInsChar, bool bSttQuote,
|
2000-09-18 16:07:07 +00:00
|
|
|
LanguageType eLang ) const
|
|
|
|
{
|
|
|
|
sal_Unicode cRet = bSttQuote ? ( '\"' == cInsChar
|
|
|
|
? GetStartDoubleQuote()
|
|
|
|
: GetStartSingleQuote() )
|
|
|
|
: ( '\"' == cInsChar
|
|
|
|
? GetEndDoubleQuote()
|
|
|
|
: GetEndSingleQuote() );
|
|
|
|
if( !cRet )
|
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// then through the Language find the right character
|
2000-09-18 16:07:07 +00:00
|
|
|
if( LANGUAGE_NONE == eLang )
|
|
|
|
cRet = cInsChar;
|
|
|
|
else
|
|
|
|
{
|
2001-05-11 17:20:34 +00:00
|
|
|
LocaleDataWrapper& rLcl = GetLocaleDataWrapper( eLang );
|
2013-09-20 13:47:10 +02:00
|
|
|
OUString sRet( bSttQuote
|
2001-05-11 17:20:34 +00:00
|
|
|
? ( '\"' == cInsChar
|
|
|
|
? rLcl.getDoubleQuotationMarkStart()
|
|
|
|
: rLcl.getQuotationMarkStart() )
|
|
|
|
: ( '\"' == cInsChar
|
|
|
|
? rLcl.getDoubleQuotationMarkEnd()
|
|
|
|
: rLcl.getQuotationMarkEnd() ));
|
2013-09-20 13:47:10 +02:00
|
|
|
cRet = !sRet.isEmpty() ? sRet[0] : cInsChar;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return cRet;
|
|
|
|
}
|
|
|
|
|
2014-01-15 10:14:52 +00:00
|
|
|
void SvxAutoCorrect::InsertQuote( SvxAutoCorrDoc& rDoc, sal_Int32 nInsPos,
|
2014-02-26 11:01:45 +02:00
|
|
|
sal_Unicode cInsChar, bool bSttQuote,
|
|
|
|
bool bIns )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-08-11 08:41:51 +02:00
|
|
|
LanguageType eLang = rDoc.GetLanguage( nInsPos );
|
2002-08-19 07:11:24 +00:00
|
|
|
sal_Unicode cRet = GetQuote( cInsChar, bSttQuote, eLang );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sChg( cInsChar );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( bIns )
|
|
|
|
rDoc.Insert( nInsPos, sChg );
|
|
|
|
else
|
|
|
|
rDoc.Replace( nInsPos, sChg );
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
sChg = OUString(cRet);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( '\"' == cInsChar )
|
|
|
|
{
|
|
|
|
if( LANGUAGE_SYSTEM == eLang )
|
2012-11-24 18:54:09 +01:00
|
|
|
eLang = GetAppLang().getLanguageType();
|
2000-09-18 16:07:07 +00:00
|
|
|
switch( eLang )
|
|
|
|
{
|
|
|
|
case LANGUAGE_FRENCH:
|
|
|
|
case LANGUAGE_FRENCH_BELGIAN:
|
|
|
|
case LANGUAGE_FRENCH_CANADIAN:
|
|
|
|
case LANGUAGE_FRENCH_SWISS:
|
|
|
|
case LANGUAGE_FRENCH_LUXEMBOURG:
|
|
|
|
{
|
2013-09-22 00:19:12 +02:00
|
|
|
OUString s( cNonBreakingSpace );
|
2004-02-26 12:46:51 +00:00
|
|
|
// UNICODE code for no break space
|
2000-09-18 16:07:07 +00:00
|
|
|
if( rDoc.Insert( bSttQuote ? nInsPos+1 : nInsPos, s ))
|
|
|
|
{
|
|
|
|
if( !bSttQuote )
|
|
|
|
++nInsPos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rDoc.Replace( nInsPos, sChg );
|
|
|
|
}
|
|
|
|
|
2014-01-15 10:14:52 +00:00
|
|
|
OUString SvxAutoCorrect::GetQuote( SvxAutoCorrDoc& rDoc, sal_Int32 nInsPos,
|
2014-02-26 11:01:45 +02:00
|
|
|
sal_Unicode cInsChar, bool bSttQuote )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-08-11 08:41:51 +02:00
|
|
|
LanguageType eLang = rDoc.GetLanguage( nInsPos );
|
2002-08-19 07:11:24 +00:00
|
|
|
sal_Unicode cRet = GetQuote( cInsChar, bSttQuote, eLang );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-09-20 13:47:10 +02:00
|
|
|
OUString sRet = OUString(cRet);
|
2011-02-16 16:34:02 -05:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if( '\"' == cInsChar )
|
|
|
|
{
|
|
|
|
if( LANGUAGE_SYSTEM == eLang )
|
2012-11-24 18:54:09 +01:00
|
|
|
eLang = GetAppLang().getLanguageType();
|
2000-09-18 16:07:07 +00:00
|
|
|
switch( eLang )
|
|
|
|
{
|
|
|
|
case LANGUAGE_FRENCH:
|
|
|
|
case LANGUAGE_FRENCH_BELGIAN:
|
|
|
|
case LANGUAGE_FRENCH_CANADIAN:
|
|
|
|
case LANGUAGE_FRENCH_SWISS:
|
|
|
|
case LANGUAGE_FRENCH_LUXEMBOURG:
|
|
|
|
if( bSttQuote )
|
2013-09-20 13:47:10 +02:00
|
|
|
sRet += " ";
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2013-09-20 13:47:10 +02:00
|
|
|
sRet = " " + sRet;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return sRet;
|
|
|
|
}
|
|
|
|
|
2016-01-11 16:02:17 +02:00
|
|
|
void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 nInsPos, sal_Unicode cChar,
|
2014-09-23 11:20:40 +02:00
|
|
|
bool bInsert, vcl::Window* pFrameWin )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-03-16 11:50:00 +01:00
|
|
|
bool bIsNextRun = bRunNext;
|
2010-03-15 18:16:49 +01:00
|
|
|
bRunNext = false; // if it was set, then it has to be turned off
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
do{ // only for middle check loop !!
|
|
|
|
if( cChar )
|
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// Prevent double space
|
2000-09-18 16:07:07 +00:00
|
|
|
if( nInsPos && ' ' == cChar &&
|
2010-01-15 11:55:56 +01:00
|
|
|
IsAutoCorrFlag( IgnoreDoubleSpace ) &&
|
2013-09-18 13:51:35 +01:00
|
|
|
' ' == rTxt[ nInsPos - 1 ])
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bSingle = '\'' == cChar;
|
|
|
|
bool bIsReplaceQuote =
|
2000-09-18 16:07:07 +00:00
|
|
|
(IsAutoCorrFlag( ChgQuotes ) && ('\"' == cChar )) ||
|
|
|
|
(IsAutoCorrFlag( ChgSglQuotes ) && bSingle );
|
|
|
|
if( bIsReplaceQuote )
|
|
|
|
{
|
|
|
|
sal_Unicode cPrev;
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bSttQuote = !nInsPos ||
|
2013-09-18 13:51:35 +01:00
|
|
|
IsWordDelim( ( cPrev = rTxt[ nInsPos-1 ])) ||
|
2000-09-18 16:07:07 +00:00
|
|
|
lcl_IsInAsciiArr( "([{", cPrev ) ||
|
|
|
|
( cEmDash && cEmDash == cPrev ) ||
|
|
|
|
( cEnDash && cEnDash == cPrev );
|
|
|
|
|
|
|
|
InsertQuote( rDoc, nInsPos, cChar, bSttQuote, bInsert );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bInsert )
|
2013-04-07 12:06:47 +02:00
|
|
|
rDoc.Insert( nInsPos, OUString(cChar) );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2013-04-07 12:06:47 +02:00
|
|
|
rDoc.Replace( nInsPos, OUString(cChar) );
|
2010-01-21 13:58:49 +01:00
|
|
|
|
|
|
|
// Hardspaces autocorrection
|
2010-03-16 11:50:00 +01:00
|
|
|
if ( IsAutoCorrFlag( AddNonBrkSpace ) )
|
2010-01-21 13:58:49 +01:00
|
|
|
{
|
2010-03-16 11:50:00 +01:00
|
|
|
if ( NeedsHardspaceAutocorr( cChar ) &&
|
2015-08-11 08:41:51 +02:00
|
|
|
FnAddNonBrkSpace( rDoc, rTxt, 0, nInsPos, rDoc.GetLanguage( nInsPos ) ) )
|
2010-03-16 11:50:00 +01:00
|
|
|
{
|
2016-01-15 10:07:17 +00:00
|
|
|
;
|
2010-03-16 11:50:00 +01:00
|
|
|
}
|
|
|
|
else if ( bIsNextRun && !IsAutoCorrectChar( cChar ) )
|
|
|
|
{
|
|
|
|
// Remove the NBSP if it wasn't an autocorrection
|
2013-09-18 13:51:35 +01:00
|
|
|
if ( nInsPos != 0 && NeedsHardspaceAutocorr( rTxt[ nInsPos - 1 ] ) &&
|
2013-09-22 00:19:12 +02:00
|
|
|
cChar != ' ' && cChar != '\t' && cChar != cNonBreakingSpace )
|
2010-03-16 11:50:00 +01:00
|
|
|
{
|
|
|
|
// Look for the last HARD_SPACE
|
2013-09-18 13:51:35 +01:00
|
|
|
sal_Int32 nPos = nInsPos - 1;
|
2010-07-29 14:57:46 +02:00
|
|
|
bool bContinue = true;
|
|
|
|
while ( bContinue )
|
2010-03-16 11:50:00 +01:00
|
|
|
{
|
2013-09-18 13:51:35 +01:00
|
|
|
const sal_Unicode cTmpChar = rTxt[ nPos ];
|
2013-09-22 00:19:12 +02:00
|
|
|
if ( cTmpChar == cNonBreakingSpace )
|
2010-07-29 14:57:46 +02:00
|
|
|
{
|
|
|
|
rDoc.Delete( nPos, nPos + 1 );
|
|
|
|
bContinue = false;
|
|
|
|
}
|
|
|
|
else if ( !NeedsHardspaceAutocorr( cTmpChar ) || nPos == 0 )
|
|
|
|
bContinue = false;
|
2010-03-16 11:50:00 +01:00
|
|
|
nPos--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-01-21 13:58:49 +01:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( !nInsPos )
|
|
|
|
break;
|
|
|
|
|
2013-09-18 13:51:35 +01:00
|
|
|
sal_Int32 nPos = nInsPos - 1;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-09-18 13:51:35 +01:00
|
|
|
if( IsWordDelim( rTxt[ nPos ]))
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Set bold or underline automatically?
|
2016-11-22 14:41:33 +00:00
|
|
|
if (('*' == cChar || '_' == cChar || '/' == cChar || '-' == cChar) && (nPos+1 < rTxt.getLength()))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2016-01-15 10:07:17 +00:00
|
|
|
if( IsAutoCorrFlag( ChgWeightUnderl ) )
|
|
|
|
{
|
|
|
|
FnChgWeightUnderl( rDoc, rTxt, 0, nPos+1 );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-09-18 13:51:35 +01:00
|
|
|
while( nPos && !IsWordDelim( rTxt[ --nPos ]))
|
2000-09-18 16:07:07 +00:00
|
|
|
;
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Found a Paragraph-start or a Blank, search for the word shortcut in
|
|
|
|
// auto.
|
2013-09-18 13:51:35 +01:00
|
|
|
sal_Int32 nCapLttrPos = nPos+1; // on the 1st Character
|
|
|
|
if( !nPos && !IsWordDelim( rTxt[ 0 ]))
|
2000-09-18 16:07:07 +00:00
|
|
|
--nCapLttrPos; // Absatz Anfang und kein Blank !
|
|
|
|
|
2015-08-11 08:41:51 +02:00
|
|
|
LanguageType eLang = rDoc.GetLanguage( nCapLttrPos );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( LANGUAGE_SYSTEM == eLang )
|
2006-04-07 13:03:36 +00:00
|
|
|
eLang = MsLangId::getSystemLanguage();
|
2000-10-18 10:45:13 +00:00
|
|
|
CharClass& rCC = GetCharClass( eLang );
|
|
|
|
|
2010-12-29 11:28:47 +01:00
|
|
|
// no symbol characters
|
2000-10-18 10:45:13 +00:00
|
|
|
if( lcl_IsSymbolChar( rCC, rTxt, nCapLttrPos, nInsPos ))
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( IsAutoCorrFlag( Autocorrect ) )
|
|
|
|
{
|
2013-09-06 12:01:31 +02:00
|
|
|
OUString aPara;
|
2015-11-10 10:14:16 +01:00
|
|
|
OUString* pPara = IsAutoCorrFlag(CapitalStartSentence) ? &aPara : nullptr;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-09-18 13:51:35 +01:00
|
|
|
bool bChgWord = rDoc.ChgAutoCorrWord( nCapLttrPos, nInsPos,
|
2013-09-06 12:01:31 +02:00
|
|
|
*this, pPara );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( !bChgWord )
|
|
|
|
{
|
2013-09-18 13:51:35 +01:00
|
|
|
sal_Int32 nCapLttrPos1 = nCapLttrPos, nInsPos1 = nInsPos;
|
2000-09-18 16:07:07 +00:00
|
|
|
while( nCapLttrPos1 < nInsPos &&
|
2013-09-18 13:51:35 +01:00
|
|
|
lcl_IsInAsciiArr( sImplSttSkipChars, rTxt[ nCapLttrPos1 ] )
|
2000-09-18 16:07:07 +00:00
|
|
|
)
|
|
|
|
++nCapLttrPos1;
|
|
|
|
while( nCapLttrPos1 < nInsPos1 && nInsPos1 &&
|
2013-09-18 13:51:35 +01:00
|
|
|
lcl_IsInAsciiArr( sImplEndSkipChars, rTxt[ nInsPos1-1 ] )
|
2000-09-18 16:07:07 +00:00
|
|
|
)
|
|
|
|
--nInsPos1;
|
|
|
|
|
|
|
|
if( (nCapLttrPos1 != nCapLttrPos || nInsPos1 != nInsPos ) &&
|
|
|
|
nCapLttrPos1 < nInsPos1 &&
|
2013-09-06 12:01:31 +02:00
|
|
|
rDoc.ChgAutoCorrWord( nCapLttrPos1, nInsPos1, *this, pPara ))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-09-18 13:51:35 +01:00
|
|
|
bChgWord = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
nCapLttrPos = nCapLttrPos1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bChgWord )
|
|
|
|
{
|
2013-09-06 12:01:31 +02:00
|
|
|
if( !aPara.isEmpty() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 nEnd = nCapLttrPos;
|
2013-09-06 12:01:31 +02:00
|
|
|
while( nEnd < aPara.getLength() &&
|
|
|
|
!IsWordDelim( aPara[ nEnd ]))
|
2000-09-18 16:07:07 +00:00
|
|
|
++nEnd;
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Capital letter at beginning of paragraph?
|
2016-01-15 10:07:17 +00:00
|
|
|
if( IsAutoCorrFlag( CapitalStartSentence ) )
|
|
|
|
{
|
2015-05-26 09:49:42 +02:00
|
|
|
FnCapitalStartSentence( rDoc, aPara, false,
|
2016-01-15 10:07:17 +00:00
|
|
|
nCapLttrPos, nEnd, eLang );
|
|
|
|
}
|
2001-05-17 16:21:59 +00:00
|
|
|
|
2016-01-15 10:07:17 +00:00
|
|
|
if( IsAutoCorrFlag( ChgToEnEmDash ) )
|
|
|
|
{
|
|
|
|
FnChgToEnEmDash( rDoc, rTxt, nCapLttrPos, nEnd, eLang );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-15 10:07:17 +00:00
|
|
|
if( ( IsAutoCorrFlag( ChgOrdinalNumber ) &&
|
2013-10-10 20:16:07 +02:00
|
|
|
(nInsPos >= 2 ) && // fdo#69762 avoid autocorrect for 2e-3
|
2016-06-21 11:45:30 +03:00
|
|
|
( '-' != cChar || 'E' != rtl::toAsciiUpperCase(rTxt[nInsPos-1]) || '0' > rTxt[nInsPos-2] || '9' < rTxt[nInsPos-2] ) &&
|
2000-10-18 10:45:13 +00:00
|
|
|
FnChgOrdinalNumber( rDoc, rTxt, nCapLttrPos, nInsPos, eLang ) ) ||
|
2016-01-15 10:07:17 +00:00
|
|
|
( IsAutoCorrFlag( SetINetAttr ) &&
|
2000-09-18 16:07:07 +00:00
|
|
|
( ' ' == cChar || '\t' == cChar || 0x0a == cChar || !cChar ) &&
|
2000-10-18 10:45:13 +00:00
|
|
|
FnSetINetAttr( rDoc, rTxt, nCapLttrPos, nInsPos, eLang ) ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
;
|
|
|
|
else
|
|
|
|
{
|
2014-12-31 18:39:32 +02:00
|
|
|
bool bLockKeyOn = pFrameWin && (pFrameWin->GetIndicatorState() & KeyIndicatorState::CAPSLOCK);
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
bool bUnsupported = lcl_IsUnsupportedUnicodeChar( rCC, rTxt, nCapLttrPos, nInsPos );
|
2010-09-29 16:20:12 -04:00
|
|
|
|
|
|
|
if ( bLockKeyOn && IsAutoCorrFlag( CorrectCapsLock ) &&
|
|
|
|
FnCorrectCapsLock( rDoc, rTxt, nCapLttrPos, nInsPos, eLang ) )
|
|
|
|
{
|
|
|
|
// Correct accidental use of cAPS LOCK key (do this only when
|
|
|
|
// the caps or shift lock key is pressed). Turn off the caps
|
|
|
|
// lock afterwords.
|
|
|
|
pFrameWin->SimulateKeyPress( KEY_CAPSLOCK );
|
|
|
|
}
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Capital letter at beginning of paragraph ?
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
if( !bUnsupported &&
|
2016-01-15 10:07:17 +00:00
|
|
|
IsAutoCorrFlag( CapitalStartSentence ) )
|
|
|
|
{
|
|
|
|
FnCapitalStartSentence( rDoc, rTxt, true, nCapLttrPos, nInsPos, eLang );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Two capital letters at beginning of word ??
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
if( !bUnsupported &&
|
2016-01-15 10:07:17 +00:00
|
|
|
IsAutoCorrFlag( CapitalStartWord ) )
|
|
|
|
{
|
|
|
|
FnCapitalStartWord( rDoc, rTxt, nCapLttrPos, nInsPos, eLang );
|
|
|
|
}
|
2001-05-17 16:21:59 +00:00
|
|
|
|
2016-01-15 10:07:17 +00:00
|
|
|
if( IsAutoCorrFlag( ChgToEnEmDash ) )
|
|
|
|
{
|
|
|
|
FnChgToEnEmDash( rDoc, rTxt, nCapLttrPos, nInsPos, eLang );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-05-17 16:21:59 +00:00
|
|
|
|
2013-03-04 23:11:48 +09:00
|
|
|
} while( false );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2016-04-06 12:07:30 +02:00
|
|
|
SvxAutoCorrectLanguageLists& SvxAutoCorrect::GetLanguageList_(
|
2000-09-18 16:07:07 +00:00
|
|
|
LanguageType eLang )
|
|
|
|
{
|
2013-09-21 15:20:49 +02:00
|
|
|
LanguageTag aLanguageTag( eLang);
|
2015-07-17 18:19:29 +02:00
|
|
|
if (m_pLangTable->find(aLanguageTag) == m_pLangTable->end())
|
2015-08-11 08:41:51 +02:00
|
|
|
(void)CreateLanguageFile(aLanguageTag);
|
2015-07-17 18:19:29 +02:00
|
|
|
return *(m_pLangTable->find(aLanguageTag)->second);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SvxAutoCorrect::SaveCplSttExceptList( LanguageType eLang )
|
|
|
|
{
|
2015-07-17 18:19:29 +02:00
|
|
|
auto const iter = m_pLangTable->find(LanguageTag(eLang));
|
|
|
|
if (iter != m_pLangTable->end() && iter->second)
|
|
|
|
iter->second->SaveCplSttExceptList();
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_WARN("editeng", "Save an empty list? ");
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxAutoCorrect::SaveWrdSttExceptList(LanguageType eLang)
|
|
|
|
{
|
2015-07-17 18:19:29 +02:00
|
|
|
auto const iter = m_pLangTable->find(LanguageTag(eLang));
|
|
|
|
if (iter != m_pLangTable->end() && iter->second)
|
|
|
|
iter->second->SaveWrdSttExceptList();
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_WARN("editeng", "Save an empty list? ");
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-28 12:43:40 +00:00
|
|
|
// Adds a single word. The list will immediately be written to the file!
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrect::AddCplSttException( const OUString& rNew,
|
2000-09-18 16:07:07 +00:00
|
|
|
LanguageType eLang )
|
|
|
|
{
|
2015-11-10 10:14:16 +01:00
|
|
|
SvxAutoCorrectLanguageLists* pLists = nullptr;
|
2011-02-16 16:34:02 -05:00
|
|
|
// either the right language is present or it will be this in the general list
|
2015-07-17 18:19:29 +02:00
|
|
|
auto iter = m_pLangTable->find(LanguageTag(eLang));
|
|
|
|
if (iter != m_pLangTable->end())
|
|
|
|
pLists = iter->second.get();
|
2011-12-24 15:52:50 -05:00
|
|
|
else
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-09-21 15:20:49 +02:00
|
|
|
LanguageTag aLangTagUndetermined( LANGUAGE_UNDETERMINED);
|
2015-07-17 18:19:29 +02:00
|
|
|
iter = m_pLangTable->find(aLangTagUndetermined);
|
|
|
|
if (iter != m_pLangTable->end())
|
|
|
|
pLists = iter->second.get();
|
2015-08-11 08:41:51 +02:00
|
|
|
else if(CreateLanguageFile(aLangTagUndetermined))
|
2015-07-17 18:19:29 +02:00
|
|
|
pLists = m_pLangTable->find(aLangTagUndetermined)->second.get();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2011-03-29 19:14:24 +02:00
|
|
|
OSL_ENSURE(pLists, "No auto correction data");
|
2015-04-24 12:25:45 +02:00
|
|
|
return pLists && pLists->AddToCplSttExceptList(rNew);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-12-24 15:52:50 -05:00
|
|
|
// Adds a single word. The list will immediately be written to the file!
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrect::AddWrtSttException( const OUString& rNew,
|
2000-09-18 16:07:07 +00:00
|
|
|
LanguageType eLang )
|
|
|
|
{
|
2015-11-10 10:14:16 +01:00
|
|
|
SvxAutoCorrectLanguageLists* pLists = nullptr;
|
2011-02-16 16:34:02 -05:00
|
|
|
//either the right language is present or it is set in the general list
|
2015-07-17 18:19:29 +02:00
|
|
|
auto iter = m_pLangTable->find(LanguageTag(eLang));
|
|
|
|
if (iter != m_pLangTable->end())
|
|
|
|
pLists = iter->second.get();
|
2011-12-24 15:52:50 -05:00
|
|
|
else
|
|
|
|
{
|
2013-09-21 15:20:49 +02:00
|
|
|
LanguageTag aLangTagUndetermined( LANGUAGE_UNDETERMINED);
|
2015-07-17 18:19:29 +02:00
|
|
|
iter = m_pLangTable->find(aLangTagUndetermined);
|
|
|
|
if (iter != m_pLangTable->end())
|
|
|
|
pLists = iter->second.get();
|
2015-08-11 08:41:51 +02:00
|
|
|
else if(CreateLanguageFile(aLangTagUndetermined))
|
2015-07-17 18:19:29 +02:00
|
|
|
pLists = m_pLangTable->find(aLangTagUndetermined)->second.get();
|
2011-12-24 15:52:50 -05:00
|
|
|
}
|
2012-09-19 20:23:49 +02:00
|
|
|
OSL_ENSURE(pLists, "No auto correction file!");
|
2015-04-24 12:25:45 +02:00
|
|
|
return pLists && pLists->AddToWrdSttExceptList(rNew);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrect::GetPrevAutoCorrWord( SvxAutoCorrDoc& rDoc,
|
2014-01-15 10:14:52 +00:00
|
|
|
const OUString& rTxt, sal_Int32 nPos,
|
2013-09-20 08:17:02 +02:00
|
|
|
OUString& rWord ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if( !nPos )
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 nEnde = nPos;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// it must be followed by a blank or tab!
|
2013-09-20 08:17:02 +02:00
|
|
|
if( ( nPos < rTxt.getLength() &&
|
|
|
|
!IsWordDelim( rTxt[ nPos ])) ||
|
|
|
|
IsWordDelim( rTxt[ --nPos ]))
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-09-20 08:17:02 +02:00
|
|
|
while( nPos && !IsWordDelim( rTxt[ --nPos ]))
|
2000-09-18 16:07:07 +00:00
|
|
|
;
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Found a Paragraph-start or a Blank, search for the word shortcut in
|
|
|
|
// auto.
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 nCapLttrPos = nPos+1; // on the 1st Character
|
2013-09-20 08:17:02 +02:00
|
|
|
if( !nPos && !IsWordDelim( rTxt[ 0 ]))
|
2011-02-16 16:34:02 -05:00
|
|
|
--nCapLttrPos; // Beginning of pargraph and no Blank!
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-09-20 08:17:02 +02:00
|
|
|
while( lcl_IsInAsciiArr( sImplSttSkipChars, rTxt[ nCapLttrPos ]) )
|
2000-09-18 16:07:07 +00:00
|
|
|
if( ++nCapLttrPos >= nEnde )
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-10-18 10:45:13 +00:00
|
|
|
if( 3 > nEnde - nCapLttrPos )
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-10-18 10:45:13 +00:00
|
|
|
|
2015-08-11 08:41:51 +02:00
|
|
|
LanguageType eLang = rDoc.GetLanguage( nCapLttrPos );
|
2000-10-18 10:45:13 +00:00
|
|
|
if( LANGUAGE_SYSTEM == eLang )
|
2006-04-07 13:03:36 +00:00
|
|
|
eLang = MsLangId::getSystemLanguage();
|
2000-10-18 10:45:13 +00:00
|
|
|
|
2015-03-26 15:28:32 +01:00
|
|
|
SvxAutoCorrect* pThis = const_cast<SvxAutoCorrect*>(this);
|
2000-10-18 10:45:13 +00:00
|
|
|
CharClass& rCC = pThis->GetCharClass( eLang );
|
|
|
|
|
|
|
|
if( lcl_IsSymbolChar( rCC, rTxt, nCapLttrPos, nEnde ))
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-09-20 08:17:02 +02:00
|
|
|
rWord = rTxt.copy( nCapLttrPos, nEnde - nCapLttrPos );
|
2014-02-26 11:01:45 +02:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrect::CreateLanguageFile( const LanguageTag& rLanguageTag, bool bNewFile )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-07-17 18:19:29 +02:00
|
|
|
OSL_ENSURE(m_pLangTable->find(rLanguageTag) == m_pLangTable->end(), "Language already exists ");
|
2000-10-18 10:45:13 +00:00
|
|
|
|
2015-10-19 17:49:51 +02:00
|
|
|
OUString sUserDirFile( GetAutoCorrFileName( rLanguageTag, true ));
|
2013-08-09 11:40:25 +01:00
|
|
|
OUString sShareDirFile( sUserDirFile );
|
|
|
|
|
2015-11-10 10:14:16 +01:00
|
|
|
SvxAutoCorrectLanguageLists* pLists = nullptr;
|
2000-10-18 10:45:13 +00:00
|
|
|
|
2014-09-28 15:49:26 +02:00
|
|
|
tools::Time nMinTime( 0, 2 ), nAktTime( tools::Time::SYSTEM ), nLastCheckTime( tools::Time::EMPTY );
|
2011-12-23 16:17:40 -05:00
|
|
|
|
2013-09-21 15:20:49 +02:00
|
|
|
std::map<LanguageTag, long>::iterator nFndPos = aLastFileTable.find(rLanguageTag);
|
2011-12-24 06:38:12 +01:00
|
|
|
if(nFndPos != aLastFileTable.end() &&
|
2011-12-23 16:17:40 -05:00
|
|
|
(nLastCheckTime.SetTime(nFndPos->second), nLastCheckTime < nAktTime) &&
|
|
|
|
nAktTime - nLastCheckTime < nMinTime)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2000-10-18 10:45:13 +00:00
|
|
|
// no need to test the file, because the last check is not older then
|
|
|
|
// 2 minutes.
|
2000-11-20 20:18:47 +00:00
|
|
|
if( bNewFile )
|
|
|
|
{
|
2013-08-09 11:40:25 +01:00
|
|
|
sShareDirFile = sUserDirFile;
|
|
|
|
pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile, sUserDirFile );
|
2013-09-21 15:20:49 +02:00
|
|
|
LanguageTag aTmp(rLanguageTag); // this insert() needs a non-const reference
|
2015-07-17 18:19:29 +02:00
|
|
|
m_pLangTable->insert(std::make_pair(aTmp, std::unique_ptr<SvxAutoCorrectLanguageLists>(pLists)));
|
2011-12-24 06:38:12 +01:00
|
|
|
aLastFileTable.erase(nFndPos);
|
2000-11-20 20:18:47 +00:00
|
|
|
}
|
2000-10-18 10:45:13 +00:00
|
|
|
}
|
2014-06-18 21:08:03 +02:00
|
|
|
else if(
|
|
|
|
( FStatHelper::IsDocument( sUserDirFile ) ||
|
|
|
|
FStatHelper::IsDocument( sShareDirFile =
|
2015-10-19 17:49:51 +02:00
|
|
|
GetAutoCorrFileName( rLanguageTag ) ) ||
|
2014-06-18 21:08:03 +02:00
|
|
|
FStatHelper::IsDocument( sShareDirFile =
|
|
|
|
GetAutoCorrFileName( rLanguageTag, false, false, true) )
|
|
|
|
) ||
|
|
|
|
( sShareDirFile = sUserDirFile, bNewFile )
|
|
|
|
)
|
2000-10-18 10:45:13 +00:00
|
|
|
{
|
2013-08-09 11:40:25 +01:00
|
|
|
pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile, sUserDirFile );
|
2013-09-21 15:20:49 +02:00
|
|
|
LanguageTag aTmp(rLanguageTag); // this insert() needs a non-const reference
|
2015-07-17 18:19:29 +02:00
|
|
|
m_pLangTable->insert(std::make_pair(aTmp, std::unique_ptr<SvxAutoCorrectLanguageLists>(pLists)));
|
2011-12-26 23:58:47 +04:00
|
|
|
if (nFndPos != aLastFileTable.end())
|
|
|
|
aLastFileTable.erase(nFndPos);
|
2000-10-18 10:45:13 +00:00
|
|
|
}
|
|
|
|
else if( !bNewFile )
|
|
|
|
{
|
2013-09-21 15:20:49 +02:00
|
|
|
aLastFileTable[rLanguageTag] = nAktTime.GetTime();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2015-11-10 10:14:16 +01:00
|
|
|
return pLists != nullptr;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrect::PutText( const OUString& rShort, const OUString& rLong,
|
2000-09-18 16:07:07 +00:00
|
|
|
LanguageType eLang )
|
|
|
|
{
|
2013-09-21 15:20:49 +02:00
|
|
|
LanguageTag aLanguageTag( eLang);
|
2015-07-17 18:19:29 +02:00
|
|
|
auto const iter = m_pLangTable->find(aLanguageTag);
|
|
|
|
if (iter != m_pLangTable->end())
|
|
|
|
return iter->second->PutText(rShort, rLong);
|
2013-09-21 15:20:49 +02:00
|
|
|
if(CreateLanguageFile(aLanguageTag))
|
2015-07-17 18:19:29 +02:00
|
|
|
return m_pLangTable->find(aLanguageTag)->second->PutText(rShort, rLong);
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2016-01-11 16:02:17 +02:00
|
|
|
void SvxAutoCorrect::MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNewEntries,
|
2012-09-23 21:49:45 +02:00
|
|
|
std::vector<SvxAutocorrWord>& aDeleteEntries,
|
|
|
|
LanguageType eLang )
|
|
|
|
{
|
2013-09-21 15:20:49 +02:00
|
|
|
LanguageTag aLanguageTag( eLang);
|
2015-07-17 18:19:29 +02:00
|
|
|
auto const iter = m_pLangTable->find(aLanguageTag);
|
|
|
|
if (iter != m_pLangTable->end())
|
2012-09-23 21:49:45 +02:00
|
|
|
{
|
2016-01-11 16:02:17 +02:00
|
|
|
iter->second->MakeCombinedChanges( aNewEntries, aDeleteEntries );
|
2012-09-23 21:49:45 +02:00
|
|
|
}
|
2013-09-21 15:20:49 +02:00
|
|
|
else if(CreateLanguageFile( aLanguageTag ))
|
2012-09-23 21:49:45 +02:00
|
|
|
{
|
2016-01-11 16:02:17 +02:00
|
|
|
m_pLangTable->find( aLanguageTag )->second->MakeCombinedChanges( aNewEntries, aDeleteEntries );
|
2012-09-23 21:49:45 +02:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-08-21 22:48:22 +01:00
|
|
|
// - return the replacement text (only for SWG-Format, all other
|
|
|
|
// can be taken from the word list!)
|
2014-10-30 14:53:48 +00:00
|
|
|
bool SvxAutoCorrect::GetLongText( const OUString&, OUString& )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-10-30 14:53:48 +00:00
|
|
|
void SvxAutoCorrect::refreshBlockList( const uno::Reference< embed::XStorage >& )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-08-21 22:48:22 +01:00
|
|
|
// Text with attribution (only the SWG - SWG format!)
|
2015-09-11 15:44:09 +02:00
|
|
|
bool SvxAutoCorrect::PutText( const css::uno::Reference < css::embed::XStorage >&,
|
2014-08-21 22:48:22 +01:00
|
|
|
const OUString&, const OUString&, SfxObjectShell&, OUString& )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-09-08 16:34:47 +01:00
|
|
|
OUString EncryptBlockName_Imp(const OUString& rName)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-09-08 16:34:47 +01:00
|
|
|
OUStringBuffer aName;
|
|
|
|
aName.append('#').append(rName);
|
|
|
|
for (sal_Int32 nLen = rName.getLength(), nPos = 1; nPos < nLen; ++nPos)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-09-08 16:34:47 +01:00
|
|
|
if (lcl_IsInAsciiArr( "!/:.\\", aName[nPos]))
|
|
|
|
aName[nPos] &= 0x0f;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2013-09-08 16:34:47 +01:00
|
|
|
return aName.makeStringAndClear();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2001-05-02 15:18:26 +00:00
|
|
|
/* This code is copied from SwXMLTextBlocks::GeneratePackageName */
|
2013-09-09 18:50:22 +02:00
|
|
|
static void GeneratePackageName ( const OUString& rShort, OUString& rPackageName )
|
2001-05-02 15:18:26 +00:00
|
|
|
{
|
2013-09-09 18:50:22 +02:00
|
|
|
OString sByte(OUStringToOString(rShort, RTL_TEXTENCODING_UTF7));
|
|
|
|
OUStringBuffer aBuf(OStringToOUString(sByte, RTL_TEXTENCODING_ASCII_US));
|
|
|
|
|
|
|
|
for (sal_Int32 nPos = 0; nPos < aBuf.getLength(); ++nPos)
|
2001-05-02 15:18:26 +00:00
|
|
|
{
|
2013-09-09 18:50:22 +02:00
|
|
|
switch (aBuf[nPos])
|
|
|
|
{
|
|
|
|
case '!':
|
|
|
|
case '/':
|
|
|
|
case ':':
|
|
|
|
case '.':
|
|
|
|
case '\\':
|
|
|
|
aBuf[nPos] = '_';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2001-05-02 15:18:26 +00:00
|
|
|
}
|
2013-09-09 18:50:22 +02:00
|
|
|
|
|
|
|
rPackageName = aBuf.makeStringAndClear();
|
2001-05-02 15:18:26 +00:00
|
|
|
}
|
|
|
|
|
2012-01-09 01:00:30 -05:00
|
|
|
static const SvxAutocorrWord* lcl_SearchWordsInList(
|
2015-06-29 14:04:27 +02:00
|
|
|
SvxAutoCorrectLanguageLists* pList, const OUString& rTxt,
|
2013-09-18 13:51:35 +01:00
|
|
|
sal_Int32& rStt, sal_Int32 nEndPos)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
const SvxAutocorrWordList* pAutoCorrWordList = pList->GetAutocorrWordList();
|
2012-12-10 16:57:36 +00:00
|
|
|
return pAutoCorrWordList->SearchWordsInList( rTxt, rStt, nEndPos );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2012-09-19 20:23:49 +02:00
|
|
|
// the search for the words in the substitution table
|
2000-09-18 16:07:07 +00:00
|
|
|
const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList(
|
2013-09-18 13:51:35 +01:00
|
|
|
const OUString& rTxt, sal_Int32& rStt, sal_Int32 nEndPos,
|
2013-09-21 15:20:49 +02:00
|
|
|
SvxAutoCorrDoc&, LanguageTag& rLang )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-11-10 10:14:16 +01:00
|
|
|
const SvxAutocorrWord* pRet = nullptr;
|
2013-09-21 15:20:49 +02:00
|
|
|
LanguageTag aLanguageTag( rLang);
|
|
|
|
if( aLanguageTag.isSystemLocale() )
|
|
|
|
aLanguageTag.reset( MsLangId::getSystemLanguage());
|
|
|
|
|
|
|
|
/* TODO-BCP47: this is so ugly, should all maybe be a proper fallback
|
|
|
|
* list instead? */
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// First search for eLang, then US-English -> English
|
2012-12-13 19:51:52 +01:00
|
|
|
// and last in LANGUAGE_UNDETERMINED
|
2015-07-17 18:19:29 +02:00
|
|
|
if (m_pLangTable->find(aLanguageTag) != m_pLangTable->end() || CreateLanguageFile(aLanguageTag, false))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
//the language is available - so bring it on
|
2015-07-17 18:19:29 +02:00
|
|
|
std::unique_ptr<SvxAutoCorrectLanguageLists> const& pList = m_pLangTable->find(aLanguageTag)->second;
|
|
|
|
pRet = lcl_SearchWordsInList( pList.get(), rTxt, rStt, nEndPos );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( pRet )
|
|
|
|
{
|
2013-09-21 15:20:49 +02:00
|
|
|
rLang = aLanguageTag;
|
2000-09-18 16:07:07 +00:00
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// If it still could not be found here, then keep on searching
|
2013-09-21 15:20:49 +02:00
|
|
|
LanguageType eLang = aLanguageTag.getLanguageType();
|
2015-10-23 20:35:32 +01:00
|
|
|
// the primary language for example EN
|
2015-10-23 09:11:56 +01:00
|
|
|
aLanguageTag.reset(aLanguageTag.getLanguage());
|
2015-10-23 20:35:32 +01:00
|
|
|
LanguageType nTmpKey = aLanguageTag.getLanguageType(false);
|
|
|
|
if (nTmpKey != eLang && nTmpKey != LANGUAGE_UNDETERMINED &&
|
2015-10-23 09:11:56 +01:00
|
|
|
(m_pLangTable->find(aLanguageTag) != m_pLangTable->end() ||
|
|
|
|
CreateLanguageFile(aLanguageTag, false)))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
//the language is available - so bring it on
|
2015-07-17 18:19:29 +02:00
|
|
|
std::unique_ptr<SvxAutoCorrectLanguageLists> const& pList = m_pLangTable->find(aLanguageTag)->second;
|
|
|
|
pRet = lcl_SearchWordsInList( pList.get(), rTxt, rStt, nEndPos );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( pRet )
|
|
|
|
{
|
2013-09-21 15:20:49 +02:00
|
|
|
rLang = aLanguageTag;
|
2000-09-18 16:07:07 +00:00
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
}
|
2011-12-24 15:52:50 -05:00
|
|
|
|
2015-07-17 18:19:29 +02:00
|
|
|
if (m_pLangTable->find(aLanguageTag.reset(LANGUAGE_UNDETERMINED)) != m_pLangTable->end() ||
|
2014-02-26 11:01:45 +02:00
|
|
|
CreateLanguageFile(aLanguageTag, false))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
//the language is available - so bring it on
|
2015-07-17 18:19:29 +02:00
|
|
|
std::unique_ptr<SvxAutoCorrectLanguageLists> const& pList = m_pLangTable->find(aLanguageTag)->second;
|
|
|
|
pRet = lcl_SearchWordsInList( pList.get(), rTxt, rStt, nEndPos );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( pRet )
|
|
|
|
{
|
2013-09-21 15:20:49 +02:00
|
|
|
rLang = aLanguageTag;
|
2000-09-18 16:07:07 +00:00
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
}
|
2015-11-10 10:14:16 +01:00
|
|
|
return nullptr;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2010-11-09 01:42:14 +05:00
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
|
2013-09-16 14:31:09 +02:00
|
|
|
const OUString& sWord )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-09-21 15:20:49 +02:00
|
|
|
LanguageTag aLanguageTag( eLang);
|
|
|
|
|
|
|
|
/* TODO-BCP47: again horrible uglyness */
|
|
|
|
|
2015-10-23 20:35:32 +01:00
|
|
|
// First search for eLang, then primary language of eLang
|
2012-12-13 19:51:52 +01:00
|
|
|
// and last in LANGUAGE_UNDETERMINED
|
2011-12-24 15:52:50 -05:00
|
|
|
|
2015-07-17 18:19:29 +02:00
|
|
|
if (m_pLangTable->find(aLanguageTag) != m_pLangTable->end() || CreateLanguageFile(aLanguageTag, false))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
//the language is available - so bring it on
|
2015-07-17 18:19:29 +02:00
|
|
|
auto const& pList = m_pLangTable->find(aLanguageTag)->second;
|
2016-04-12 16:39:03 +02:00
|
|
|
if(pList->GetWrdSttExceptList()->find(sWord) != pList->GetWrdSttExceptList()->end() )
|
2014-02-26 11:01:45 +02:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2011-12-24 15:52:50 -05:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// If it still could not be found here, then keep on searching
|
2015-10-23 20:35:32 +01:00
|
|
|
// the primary language for example EN
|
2015-10-23 20:26:23 +01:00
|
|
|
aLanguageTag.reset(aLanguageTag.getLanguage());
|
2015-10-23 20:35:32 +01:00
|
|
|
LanguageType nTmpKey = aLanguageTag.getLanguageType(false);
|
|
|
|
if (nTmpKey != eLang && nTmpKey != LANGUAGE_UNDETERMINED &&
|
2015-10-23 09:11:56 +01:00
|
|
|
(m_pLangTable->find(aLanguageTag) != m_pLangTable->end() ||
|
|
|
|
CreateLanguageFile(aLanguageTag, false)))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
//the language is available - so bring it on
|
2015-07-17 18:19:29 +02:00
|
|
|
auto const& pList = m_pLangTable->find(aLanguageTag)->second;
|
2016-04-12 16:39:03 +02:00
|
|
|
if(pList->GetWrdSttExceptList()->find(sWord) != pList->GetWrdSttExceptList()->end() )
|
2014-02-26 11:01:45 +02:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2011-12-24 15:52:50 -05:00
|
|
|
|
2015-07-17 18:19:29 +02:00
|
|
|
if (m_pLangTable->find(aLanguageTag.reset(LANGUAGE_UNDETERMINED)) != m_pLangTable->end() ||
|
2014-02-26 11:01:45 +02:00
|
|
|
CreateLanguageFile(aLanguageTag, false))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
//the language is available - so bring it on
|
2015-07-17 18:19:29 +02:00
|
|
|
auto const& pList = m_pLangTable->find(aLanguageTag)->second;
|
2016-04-12 16:39:03 +02:00
|
|
|
if(pList->GetWrdSttExceptList()->find(sWord) != pList->GetWrdSttExceptList()->end() )
|
2014-02-26 11:01:45 +02:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2010-11-09 01:42:14 +05:00
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
static bool lcl_FindAbbreviation(const SvStringsISortDtor* pList, const OUString& sWord)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-09-05 16:29:13 +02:00
|
|
|
OUString sAbk('~');
|
2013-09-05 17:03:39 +02:00
|
|
|
SvStringsISortDtor::const_iterator it = pList->find( sAbk );
|
2012-07-19 12:46:29 +02:00
|
|
|
sal_uInt16 nPos = it - pList->begin();
|
|
|
|
if( nPos < pList->size() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-09-13 12:45:15 +01:00
|
|
|
OUString sLowerWord(sWord.toAsciiLowerCase());
|
2016-04-25 09:59:16 +02:00
|
|
|
OUString sAbr;
|
2011-01-13 14:12:48 +01:00
|
|
|
for( sal_uInt16 n = nPos;
|
2012-07-19 12:46:29 +02:00
|
|
|
n < pList->size() &&
|
2016-04-25 09:59:16 +02:00
|
|
|
'~' == ( sAbr = (*pList)[ n ])[ 0 ];
|
2000-09-18 16:07:07 +00:00
|
|
|
++n )
|
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// ~ and ~. are not allowed!
|
2016-04-25 09:59:16 +02:00
|
|
|
if( 2 < sAbr.getLength() && sAbr.getLength() - 1 <= sWord.getLength() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2016-04-25 09:59:16 +02:00
|
|
|
OUString sLowerAbk(sAbr.toAsciiLowerCase());
|
2013-09-13 12:45:15 +01:00
|
|
|
for (sal_Int32 i = sLowerAbk.getLength(), ii = sLowerWord.getLength(); i;)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
if( !--i ) // agrees
|
2014-02-26 11:01:45 +02:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-09-13 12:45:15 +01:00
|
|
|
if( sLowerAbk[i] != sLowerWord[--ii])
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-09-05 17:03:39 +02:00
|
|
|
OSL_ENSURE( !(nPos && '~' == (*pList)[ --nPos ][ 0 ] ),
|
2011-02-16 16:34:02 -05:00
|
|
|
"Wrongly sorted exception list?" );
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2010-11-09 01:42:14 +05:00
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
|
|
|
|
const OUString& sWord, bool bAbbreviation)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-09-21 15:20:49 +02:00
|
|
|
LanguageTag aLanguageTag( eLang);
|
|
|
|
|
|
|
|
/* TODO-BCP47: did I mention terrible horrible uglyness? */
|
|
|
|
|
2015-10-23 20:35:32 +01:00
|
|
|
// First search for eLang, then primary language of eLang
|
2012-12-13 19:51:52 +01:00
|
|
|
// and last in LANGUAGE_UNDETERMINED
|
2011-12-24 15:52:50 -05:00
|
|
|
|
2015-07-17 18:19:29 +02:00
|
|
|
if (m_pLangTable->find(aLanguageTag) != m_pLangTable->end() || CreateLanguageFile(aLanguageTag, false))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
//the language is available - so bring it on
|
2015-07-17 18:19:29 +02:00
|
|
|
const SvStringsISortDtor* pList = m_pLangTable->find(aLanguageTag)->second->GetCplSttExceptList();
|
2016-04-12 16:39:03 +02:00
|
|
|
if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(sWord) != pList->end() )
|
2014-02-26 11:01:45 +02:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2011-12-24 15:52:50 -05:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// If it still could not be found here, then keep on searching
|
2015-10-23 20:35:32 +01:00
|
|
|
// the primary language for example EN
|
2015-10-23 20:26:23 +01:00
|
|
|
aLanguageTag.reset(aLanguageTag.getLanguage());
|
2015-10-23 20:35:32 +01:00
|
|
|
LanguageType nTmpKey = aLanguageTag.getLanguageType(false);
|
|
|
|
if (nTmpKey != eLang && nTmpKey != LANGUAGE_UNDETERMINED &&
|
2015-10-23 09:11:56 +01:00
|
|
|
(m_pLangTable->find(aLanguageTag) != m_pLangTable->end() ||
|
|
|
|
CreateLanguageFile(aLanguageTag, false)))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
//the language is available - so bring it on
|
2015-07-17 18:19:29 +02:00
|
|
|
const SvStringsISortDtor* pList = m_pLangTable->find(aLanguageTag)->second->GetCplSttExceptList();
|
2016-04-12 16:39:03 +02:00
|
|
|
if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(sWord) != pList->end() )
|
2014-02-26 11:01:45 +02:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2011-12-24 15:52:50 -05:00
|
|
|
|
2015-07-17 18:19:29 +02:00
|
|
|
if (m_pLangTable->find(aLanguageTag.reset(LANGUAGE_UNDETERMINED)) != m_pLangTable->end() ||
|
2014-02-26 11:01:45 +02:00
|
|
|
CreateLanguageFile(aLanguageTag, false))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
//the language is available - so bring it on
|
2015-07-17 18:19:29 +02:00
|
|
|
const SvStringsISortDtor* pList = m_pLangTable->find(aLanguageTag)->second->GetCplSttExceptList();
|
2016-04-12 16:39:03 +02:00
|
|
|
if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(sWord) != pList->end() )
|
2014-02-26 11:01:45 +02:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2014-02-26 11:01:45 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-09-21 15:20:49 +02:00
|
|
|
OUString SvxAutoCorrect::GetAutoCorrFileName( const LanguageTag& rLanguageTag,
|
2014-06-18 21:08:03 +02:00
|
|
|
bool bNewFile, bool bTst, bool bUnlocalized ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-09-21 15:20:49 +02:00
|
|
|
OUString sRet, sExt( rLanguageTag.getBcp47() );
|
2014-06-18 21:08:03 +02:00
|
|
|
if (bUnlocalized)
|
|
|
|
{
|
|
|
|
// we don't want variant, so we'll take "fr" instead of "fr-CA" for example
|
|
|
|
::std::vector< OUString > vecFallBackStrings = rLanguageTag.getFallbackStrings(false);
|
|
|
|
if (!vecFallBackStrings.empty())
|
|
|
|
sExt = vecFallBackStrings[0];
|
|
|
|
}
|
2012-12-12 22:16:53 +00:00
|
|
|
|
2013-05-16 13:08:34 -03:00
|
|
|
sExt = "_" + sExt + ".dat";
|
2000-10-18 10:45:13 +00:00
|
|
|
if( bNewFile )
|
2005-04-27 10:29:43 +00:00
|
|
|
( sRet = sUserAutoCorrFile ) += sExt;
|
2000-10-18 10:45:13 +00:00
|
|
|
else if( !bTst )
|
2005-04-27 10:29:43 +00:00
|
|
|
( sRet = sShareAutoCorrFile ) += sExt;
|
2000-10-18 10:45:13 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// test first in the user directory - if not exist, then
|
2005-04-27 10:29:43 +00:00
|
|
|
( sRet = sUserAutoCorrFile ) += sExt;
|
2000-10-18 10:45:13 +00:00
|
|
|
if( !FStatHelper::IsDocument( sRet ))
|
2005-04-27 10:29:43 +00:00
|
|
|
( sRet = sShareAutoCorrFile ) += sExt;
|
2000-10-18 10:45:13 +00:00
|
|
|
}
|
|
|
|
return sRet;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SvxAutoCorrectLanguageLists::SvxAutoCorrectLanguageLists(
|
|
|
|
SvxAutoCorrect& rParent,
|
2013-09-06 14:32:54 +02:00
|
|
|
const OUString& rShareAutoCorrectFile,
|
|
|
|
const OUString& rUserAutoCorrectFile)
|
2006-10-12 11:40:24 +00:00
|
|
|
: sShareAutoCorrFile( rShareAutoCorrectFile ),
|
2000-10-18 10:45:13 +00:00
|
|
|
sUserAutoCorrFile( rUserAutoCorrectFile ),
|
2011-12-01 21:03:42 +01:00
|
|
|
aModifiedDate( Date::EMPTY ),
|
2014-09-28 15:49:26 +02:00
|
|
|
aModifiedTime( tools::Time::EMPTY ),
|
|
|
|
aLastCheckTime( tools::Time::EMPTY ),
|
2015-11-10 10:14:16 +01:00
|
|
|
pCplStt_ExcptLst( nullptr ),
|
|
|
|
pWrdStt_ExcptLst( nullptr ),
|
|
|
|
pAutocorr_List( nullptr ),
|
2006-10-12 11:40:24 +00:00
|
|
|
rAutoCorrect(rParent),
|
|
|
|
nFlags(0)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxAutoCorrectLanguageLists::~SvxAutoCorrectLanguageLists()
|
|
|
|
{
|
|
|
|
delete pCplStt_ExcptLst;
|
|
|
|
delete pWrdStt_ExcptLst;
|
|
|
|
delete pAutocorr_List;
|
|
|
|
}
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrectLanguageLists::IsFileChanged_Imp()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// Access the file system only every 2 minutes to check the date stamp
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bRet = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-09-28 15:49:26 +02:00
|
|
|
tools::Time nMinTime( 0, 2 );
|
|
|
|
tools::Time nAktTime( tools::Time::SYSTEM );
|
2011-02-16 16:34:02 -05:00
|
|
|
if( aLastCheckTime > nAktTime || // overflow?
|
|
|
|
( nAktTime -= aLastCheckTime ) > nMinTime ) // min time past
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-09-28 15:49:26 +02:00
|
|
|
Date aTstDate( Date::EMPTY ); tools::Time aTstTime( tools::Time::EMPTY );
|
2000-10-18 10:45:13 +00:00
|
|
|
if( FStatHelper::GetModifiedDateTimeOfFile( sShareAutoCorrFile,
|
2000-09-27 08:39:19 +00:00
|
|
|
&aTstDate, &aTstTime ) &&
|
|
|
|
( aModifiedDate != aTstDate || aModifiedTime != aTstTime ))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
bRet = true;
|
2011-02-16 16:34:02 -05:00
|
|
|
// then remove all the lists fast!
|
2000-09-18 16:07:07 +00:00
|
|
|
if( CplSttLstLoad & nFlags && pCplStt_ExcptLst )
|
2016-02-17 13:14:50 +02:00
|
|
|
{
|
|
|
|
delete pCplStt_ExcptLst;
|
|
|
|
pCplStt_ExcptLst = nullptr;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
if( WrdSttLstLoad & nFlags && pWrdStt_ExcptLst )
|
2016-02-17 13:14:50 +02:00
|
|
|
{
|
|
|
|
delete pWrdStt_ExcptLst;
|
|
|
|
pWrdStt_ExcptLst = nullptr;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
if( ChgWordLstLoad & nFlags && pAutocorr_List )
|
2016-02-17 13:14:50 +02:00
|
|
|
{
|
|
|
|
delete pAutocorr_List;
|
|
|
|
pAutocorr_List = nullptr;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
nFlags &= ~(CplSttLstLoad | WrdSttLstLoad | ChgWordLstLoad );
|
|
|
|
}
|
2014-09-28 15:49:26 +02:00
|
|
|
aLastCheckTime = tools::Time( tools::Time::SYSTEM );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2001-02-09 17:00:24 +00:00
|
|
|
void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp(
|
|
|
|
SvStringsISortDtor*& rpLst,
|
|
|
|
const sal_Char* pStrmName,
|
2015-05-06 16:33:19 +02:00
|
|
|
tools::SvRef<SotStorage>& rStg)
|
2001-02-09 17:00:24 +00:00
|
|
|
{
|
|
|
|
if( rpLst )
|
2013-09-05 17:03:39 +02:00
|
|
|
rpLst->clear();
|
2001-02-09 17:00:24 +00:00
|
|
|
else
|
2012-07-19 12:46:29 +02:00
|
|
|
rpLst = new SvStringsISortDtor;
|
2001-02-09 17:00:24 +00:00
|
|
|
|
|
|
|
{
|
2016-04-12 16:39:03 +02:00
|
|
|
const OUString sStrmName( pStrmName, strlen(pStrmName), RTL_TEXTENCODING_MS_1252 );
|
2001-02-09 17:00:24 +00:00
|
|
|
|
|
|
|
if( rStg.Is() && rStg->IsStream( sStrmName ) )
|
|
|
|
{
|
2016-04-12 16:39:03 +02:00
|
|
|
tools::SvRef<SotStorageStream> xStrm = rStg->OpenSotStream( sStrmName,
|
2015-01-07 09:28:42 +02:00
|
|
|
( StreamMode::READ | StreamMode::SHARE_DENYWRITE | StreamMode::NOCREATE ) );
|
2001-02-09 17:00:24 +00:00
|
|
|
if( SVSTREAM_OK != xStrm->GetError())
|
|
|
|
{
|
|
|
|
xStrm.Clear();
|
|
|
|
rStg.Clear();
|
|
|
|
RemoveStream_Imp( sStrmName );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-02-04 13:20:48 +02:00
|
|
|
uno::Reference< uno::XComponentContext > xContext =
|
|
|
|
comphelper::getProcessComponentContext();
|
2001-02-09 17:00:24 +00:00
|
|
|
|
|
|
|
xml::sax::InputSource aParserInput;
|
|
|
|
aParserInput.sSystemId = sStrmName;
|
|
|
|
|
|
|
|
xStrm->Seek( 0L );
|
|
|
|
xStrm->SetBufferSize( 8 * 1024 );
|
|
|
|
aParserInput.aInputStream = new utl::OInputStreamWrapper( *xStrm );
|
|
|
|
|
|
|
|
// get filter
|
2014-10-24 08:36:08 +00:00
|
|
|
uno::Reference< xml::sax::XFastDocumentHandler > xFilter = new SvXMLExceptionListImport ( xContext, *rpLst );
|
2001-02-09 17:00:24 +00:00
|
|
|
|
|
|
|
// connect parser and filter
|
2014-10-24 08:36:08 +00:00
|
|
|
uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create( xContext );
|
|
|
|
uno::Reference< xml::sax::XFastTokenHandler > xTokenHandler = static_cast< xml::sax::XFastTokenHandler* >( new SvXMLAutoCorrectTokenHandler );
|
|
|
|
xParser->setFastDocumentHandler( xFilter );
|
|
|
|
xParser->registerNamespace( "http://openoffice.org/2001/block-list", SvXMLAutoCorrectToken::NAMESPACE );
|
|
|
|
xParser->setTokenHandler( xTokenHandler );
|
2001-02-09 17:00:24 +00:00
|
|
|
|
|
|
|
// parse
|
|
|
|
try
|
|
|
|
{
|
|
|
|
xParser->parseStream( aParserInput );
|
|
|
|
}
|
2011-12-09 02:56:30 +09:00
|
|
|
catch( const xml::sax::SAXParseException& )
|
2001-02-09 17:00:24 +00:00
|
|
|
{
|
|
|
|
// re throw ?
|
|
|
|
}
|
2011-12-09 02:56:30 +09:00
|
|
|
catch( const xml::sax::SAXException& )
|
2001-02-09 17:00:24 +00:00
|
|
|
{
|
|
|
|
// re throw ?
|
|
|
|
}
|
2011-12-09 02:56:30 +09:00
|
|
|
catch( const io::IOException& )
|
2001-02-09 17:00:24 +00:00
|
|
|
{
|
|
|
|
// re throw ?
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Set time stamp
|
2001-02-09 17:00:24 +00:00
|
|
|
FStatHelper::GetModifiedDateTimeOfFile( sShareAutoCorrFile,
|
|
|
|
&aModifiedDate, &aModifiedTime );
|
2014-09-28 15:49:26 +02:00
|
|
|
aLastCheckTime = tools::Time( tools::Time::SYSTEM );
|
2001-02-09 17:00:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2010-11-09 01:42:14 +05:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void SvxAutoCorrectLanguageLists::SaveExceptList_Imp(
|
|
|
|
const SvStringsISortDtor& rLst,
|
2001-02-22 13:49:20 +00:00
|
|
|
const sal_Char* pStrmName,
|
2015-05-06 16:33:19 +02:00
|
|
|
tools::SvRef<SotStorage> &rStg,
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bConvert )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-02-22 13:49:20 +00:00
|
|
|
if( rStg.Is() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-09-20 13:47:10 +02:00
|
|
|
OUString sStrmName( pStrmName, strlen(pStrmName), RTL_TEXTENCODING_MS_1252 );
|
2012-07-19 12:46:29 +02:00
|
|
|
if( rLst.empty() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-02-22 13:49:20 +00:00
|
|
|
rStg->Remove( sStrmName );
|
|
|
|
rStg->Commit();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-05-06 16:38:01 +02:00
|
|
|
tools::SvRef<SotStorageStream> xStrm = rStg->OpenSotStream( sStrmName,
|
2015-01-07 09:28:42 +02:00
|
|
|
( StreamMode::READ | StreamMode::WRITE | StreamMode::SHARE_DENYWRITE ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( xStrm.Is() )
|
|
|
|
{
|
|
|
|
xStrm->SetSize( 0 );
|
|
|
|
xStrm->SetBufferSize( 8192 );
|
2012-05-29 21:35:26 -05:00
|
|
|
OUString aMime( "text/xml" );
|
2016-05-03 08:39:03 +02:00
|
|
|
xStrm->SetProperty( "MediaType", Any(aMime) );
|
2001-05-02 15:18:26 +00:00
|
|
|
|
|
|
|
|
2012-10-10 10:13:18 +02:00
|
|
|
uno::Reference< uno::XComponentContext > xContext =
|
|
|
|
comphelper::getProcessComponentContext();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-10-10 10:13:18 +02:00
|
|
|
uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext);
|
2007-06-05 13:34:41 +00:00
|
|
|
uno::Reference < io::XOutputStream> xOut = new utl::OOutputStreamWrapper( *xStrm );
|
2012-10-10 10:13:18 +02:00
|
|
|
xWriter->setOutputStream(xOut);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-10-10 10:13:18 +02:00
|
|
|
uno::Reference < xml::sax::XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW);
|
2016-05-26 16:02:39 +02:00
|
|
|
rtl::Reference< SvXMLExceptionListExport > xExp( new SvXMLExceptionListExport( xContext, rLst, sStrmName, xHandler ) );
|
2004-05-03 12:27:28 +00:00
|
|
|
|
2015-07-13 16:17:00 +02:00
|
|
|
xExp->exportDoc( XML_BLOCK_LIST );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
xStrm->Commit();
|
|
|
|
if( xStrm->GetError() == SVSTREAM_OK )
|
|
|
|
{
|
|
|
|
xStrm.Clear();
|
2001-02-22 13:49:20 +00:00
|
|
|
if (!bConvert)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-02-22 13:49:20 +00:00
|
|
|
rStg->Commit();
|
|
|
|
if( SVSTREAM_OK != rStg->GetError() )
|
|
|
|
{
|
|
|
|
rStg->Remove( sStrmName );
|
|
|
|
rStg->Commit();
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-11-09 01:42:14 +05:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList()
|
|
|
|
{
|
|
|
|
if( pAutocorr_List )
|
2012-07-10 14:29:46 +02:00
|
|
|
pAutocorr_List->DeleteAndDestroyAll();
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2012-07-10 14:29:46 +02:00
|
|
|
pAutocorr_List = new SvxAutocorrWordList();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2005-01-11 12:00:28 +00:00
|
|
|
try
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2005-01-11 12:00:28 +00:00
|
|
|
uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetStorageFromURL( sShareAutoCorrFile, embed::ElementModes::READ );
|
2013-09-20 13:47:10 +02:00
|
|
|
OUString aXMLWordListName( pXMLImplAutocorr_ListStr, strlen(pXMLImplAutocorr_ListStr), RTL_TEXTENCODING_MS_1252 );
|
2005-01-11 12:00:28 +00:00
|
|
|
uno::Reference < io::XStream > xStrm = xStg->openStreamElement( aXMLWordListName, embed::ElementModes::READ );
|
2012-10-03 13:30:43 +02:00
|
|
|
uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2005-01-11 12:00:28 +00:00
|
|
|
xml::sax::InputSource aParserInput;
|
|
|
|
aParserInput.sSystemId = aXMLWordListName;
|
|
|
|
aParserInput.aInputStream = xStrm->getInputStream();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2005-01-11 12:00:28 +00:00
|
|
|
// get parser
|
2014-10-24 08:36:08 +00:00
|
|
|
uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create(xContext);
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("editeng", "AutoCorrect Import" );
|
2014-10-24 08:36:08 +00:00
|
|
|
uno::Reference< xml::sax::XFastDocumentHandler > xFilter = new SvXMLAutoCorrectImport( xContext, pAutocorr_List, rAutoCorrect, xStg );
|
|
|
|
uno::Reference< xml::sax::XFastTokenHandler > xTokenHandler = static_cast< xml::sax::XFastTokenHandler* >( new SvXMLAutoCorrectTokenHandler );
|
2001-02-09 17:00:24 +00:00
|
|
|
|
2012-10-03 13:30:43 +02:00
|
|
|
// connect parser and filter
|
2014-10-24 08:36:08 +00:00
|
|
|
xParser->setFastDocumentHandler( xFilter );
|
|
|
|
xParser->registerNamespace( "http://openoffice.org/2001/block-list", SvXMLAutoCorrectToken::NAMESPACE );
|
|
|
|
xParser->setTokenHandler(xTokenHandler);
|
2001-02-09 17:00:24 +00:00
|
|
|
|
2012-10-03 13:30:43 +02:00
|
|
|
// parse
|
|
|
|
xParser->parseStream( aParserInput );
|
2005-01-11 12:00:28 +00:00
|
|
|
}
|
2011-12-09 02:56:30 +09:00
|
|
|
catch ( const uno::Exception& )
|
2005-01-11 12:00:28 +00:00
|
|
|
{
|
|
|
|
}
|
2001-02-09 17:00:24 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Set time stamp
|
2005-01-11 12:00:28 +00:00
|
|
|
FStatHelper::GetModifiedDateTimeOfFile( sShareAutoCorrFile,
|
|
|
|
&aModifiedDate, &aModifiedTime );
|
2014-09-28 15:49:26 +02:00
|
|
|
aLastCheckTime = tools::Time( tools::Time::SYSTEM );
|
2001-02-09 17:00:24 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return pAutocorr_List;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxAutoCorrectLanguageLists::SetAutocorrWordList( SvxAutocorrWordList* pList )
|
|
|
|
{
|
|
|
|
if( pAutocorr_List && pList != pAutocorr_List )
|
|
|
|
delete pAutocorr_List;
|
|
|
|
pAutocorr_List = pList;
|
|
|
|
if( !pAutocorr_List )
|
|
|
|
{
|
2014-08-11 16:11:09 +02:00
|
|
|
OSL_ENSURE( false, "No valid list" );
|
2012-07-10 14:29:46 +02:00
|
|
|
pAutocorr_List = new SvxAutocorrWordList();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
nFlags |= ChgWordLstLoad;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SvxAutocorrWordList* SvxAutoCorrectLanguageLists::GetAutocorrWordList()
|
|
|
|
{
|
|
|
|
if( !( ChgWordLstLoad & nFlags ) || IsFileChanged_Imp() )
|
|
|
|
SetAutocorrWordList( LoadAutocorrWordList() );
|
|
|
|
return pAutocorr_List;
|
|
|
|
}
|
2010-11-09 01:42:14 +05:00
|
|
|
|
2005-03-23 10:04:05 +00:00
|
|
|
SvStringsISortDtor* SvxAutoCorrectLanguageLists::GetCplSttExceptList()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if( !( CplSttLstLoad & nFlags ) || IsFileChanged_Imp() )
|
|
|
|
SetCplSttExceptList( LoadCplSttExceptList() );
|
|
|
|
return pCplStt_ExcptLst;
|
|
|
|
}
|
2010-11-09 01:42:14 +05:00
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrectLanguageLists::AddToCplSttExceptList(const OUString& rNew)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-09-25 11:41:53 +01:00
|
|
|
bool bRet = false;
|
2013-09-06 14:32:54 +02:00
|
|
|
if( !rNew.isEmpty() && GetCplSttExceptList()->insert( rNew ).second )
|
2001-02-22 13:49:20 +00:00
|
|
|
{
|
|
|
|
MakeUserStorage_Impl();
|
2016-08-27 10:18:06 +02:00
|
|
|
tools::SvRef<SotStorage> xStg = new SotStorage( sUserAutoCorrFile, StreamMode::READWRITE );
|
2001-02-22 13:49:20 +00:00
|
|
|
|
|
|
|
SaveExceptList_Imp( *pCplStt_ExcptLst, pXMLImplCplStt_ExcptLstStr, xStg );
|
|
|
|
|
2015-11-10 10:14:16 +01:00
|
|
|
xStg = nullptr;
|
2011-02-16 16:34:02 -05:00
|
|
|
// Set time stamp
|
2001-02-22 13:49:20 +00:00
|
|
|
FStatHelper::GetModifiedDateTimeOfFile( sUserAutoCorrFile,
|
|
|
|
&aModifiedDate, &aModifiedTime );
|
2014-09-28 15:49:26 +02:00
|
|
|
aLastCheckTime = tools::Time( tools::Time::SYSTEM );
|
2015-09-25 11:41:53 +01:00
|
|
|
bRet = true;
|
2001-02-22 13:49:20 +00:00
|
|
|
}
|
2015-09-25 11:41:53 +01:00
|
|
|
return bRet;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2010-11-09 01:42:14 +05:00
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrectLanguageLists::AddToWrdSttExceptList(const OUString& rNew)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-09-25 11:41:53 +01:00
|
|
|
bool bRet = false;
|
2005-04-04 11:51:52 +00:00
|
|
|
SvStringsISortDtor* pExceptList = LoadWrdSttExceptList();
|
2013-09-06 14:32:54 +02:00
|
|
|
if( !rNew.isEmpty() && pExceptList && pExceptList->insert( rNew ).second )
|
2001-02-22 13:49:20 +00:00
|
|
|
{
|
|
|
|
MakeUserStorage_Impl();
|
2016-08-27 10:18:06 +02:00
|
|
|
tools::SvRef<SotStorage> xStg = new SotStorage( sUserAutoCorrFile, StreamMode::READWRITE );
|
2001-02-22 13:49:20 +00:00
|
|
|
|
|
|
|
SaveExceptList_Imp( *pWrdStt_ExcptLst, pXMLImplWrdStt_ExcptLstStr, xStg );
|
|
|
|
|
2015-11-10 10:14:16 +01:00
|
|
|
xStg = nullptr;
|
2011-02-16 16:34:02 -05:00
|
|
|
// Set time stamp
|
2001-02-22 13:49:20 +00:00
|
|
|
FStatHelper::GetModifiedDateTimeOfFile( sUserAutoCorrFile,
|
|
|
|
&aModifiedDate, &aModifiedTime );
|
2014-09-28 15:49:26 +02:00
|
|
|
aLastCheckTime = tools::Time( tools::Time::SYSTEM );
|
2015-09-25 11:41:53 +01:00
|
|
|
bRet = true;
|
2001-02-22 13:49:20 +00:00
|
|
|
}
|
2015-09-25 11:41:53 +01:00
|
|
|
return bRet;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadCplSttExceptList()
|
|
|
|
{
|
2014-05-10 09:34:02 +01:00
|
|
|
try
|
|
|
|
{
|
2015-05-06 16:33:19 +02:00
|
|
|
tools::SvRef<SotStorage> xStg = new SotStorage( sShareAutoCorrFile, StreamMode::READ | StreamMode::SHARE_DENYNONE );
|
2014-05-10 09:34:02 +01:00
|
|
|
OUString sTemp ( pXMLImplCplStt_ExcptLstStr );
|
|
|
|
if( xStg.Is() && xStg->IsContained( sTemp ) )
|
|
|
|
LoadXMLExceptList_Imp( pCplStt_ExcptLst, pXMLImplCplStt_ExcptLstStr, xStg );
|
|
|
|
}
|
|
|
|
catch (const css::ucb::ContentCreationException&)
|
|
|
|
{
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
return pCplStt_ExcptLst;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxAutoCorrectLanguageLists::SaveCplSttExceptList()
|
|
|
|
{
|
2001-02-22 13:49:20 +00:00
|
|
|
MakeUserStorage_Impl();
|
2016-08-27 10:18:06 +02:00
|
|
|
tools::SvRef<SotStorage> xStg = new SotStorage( sUserAutoCorrFile, StreamMode::READWRITE );
|
2001-02-22 13:49:20 +00:00
|
|
|
|
|
|
|
SaveExceptList_Imp( *pCplStt_ExcptLst, pXMLImplCplStt_ExcptLstStr, xStg );
|
|
|
|
|
2015-11-10 10:14:16 +01:00
|
|
|
xStg = nullptr;
|
2004-10-04 16:50:26 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Set time stamp
|
2001-02-22 13:49:20 +00:00
|
|
|
FStatHelper::GetModifiedDateTimeOfFile( sUserAutoCorrFile,
|
|
|
|
&aModifiedDate, &aModifiedTime );
|
2014-09-28 15:49:26 +02:00
|
|
|
aLastCheckTime = tools::Time( tools::Time::SYSTEM );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SvxAutoCorrectLanguageLists::SetCplSttExceptList( SvStringsISortDtor* pList )
|
|
|
|
{
|
|
|
|
if( pCplStt_ExcptLst && pList != pCplStt_ExcptLst )
|
|
|
|
delete pCplStt_ExcptLst;
|
|
|
|
|
|
|
|
pCplStt_ExcptLst = pList;
|
|
|
|
if( !pCplStt_ExcptLst )
|
|
|
|
{
|
2014-08-11 16:11:09 +02:00
|
|
|
OSL_ENSURE( false, "No valid list" );
|
2012-07-19 12:46:29 +02:00
|
|
|
pCplStt_ExcptLst = new SvStringsISortDtor;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
nFlags |= CplSttLstLoad;
|
|
|
|
}
|
2010-11-09 01:42:14 +05:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadWrdSttExceptList()
|
|
|
|
{
|
2014-06-18 09:52:46 +01:00
|
|
|
try
|
|
|
|
{
|
2015-05-06 16:33:19 +02:00
|
|
|
tools::SvRef<SotStorage> xStg = new SotStorage( sShareAutoCorrFile, StreamMode::READ | StreamMode::SHARE_DENYNONE );
|
2014-06-18 09:52:46 +01:00
|
|
|
OUString sTemp ( pXMLImplWrdStt_ExcptLstStr );
|
|
|
|
if( xStg.Is() && xStg->IsContained( sTemp ) )
|
|
|
|
LoadXMLExceptList_Imp( pWrdStt_ExcptLst, pXMLImplWrdStt_ExcptLstStr, xStg );
|
|
|
|
}
|
2014-08-07 23:24:04 +02:00
|
|
|
catch (const css::ucb::ContentCreationException &e)
|
2014-06-18 09:52:46 +01:00
|
|
|
{
|
|
|
|
SAL_WARN("editeng", "SvxAutoCorrectLanguageLists::LoadWrdSttExceptList: Caught exception: " << e.Message);
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
return pWrdStt_ExcptLst;
|
|
|
|
}
|
2010-11-09 01:42:14 +05:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void SvxAutoCorrectLanguageLists::SaveWrdSttExceptList()
|
|
|
|
{
|
2001-02-22 13:49:20 +00:00
|
|
|
MakeUserStorage_Impl();
|
2016-08-27 10:18:06 +02:00
|
|
|
tools::SvRef<SotStorage> xStg = new SotStorage( sUserAutoCorrFile, StreamMode::READWRITE );
|
2001-02-22 13:49:20 +00:00
|
|
|
|
|
|
|
SaveExceptList_Imp( *pWrdStt_ExcptLst, pXMLImplWrdStt_ExcptLstStr, xStg );
|
|
|
|
|
2015-11-10 10:14:16 +01:00
|
|
|
xStg = nullptr;
|
2011-02-16 16:34:02 -05:00
|
|
|
// Set time stamp
|
2001-02-22 13:49:20 +00:00
|
|
|
FStatHelper::GetModifiedDateTimeOfFile( sUserAutoCorrFile,
|
|
|
|
&aModifiedDate, &aModifiedTime );
|
2014-09-28 15:49:26 +02:00
|
|
|
aLastCheckTime = tools::Time( tools::Time::SYSTEM );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2010-11-09 01:42:14 +05:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void SvxAutoCorrectLanguageLists::SetWrdSttExceptList( SvStringsISortDtor* pList )
|
|
|
|
{
|
|
|
|
if( pWrdStt_ExcptLst && pList != pWrdStt_ExcptLst )
|
|
|
|
delete pWrdStt_ExcptLst;
|
|
|
|
pWrdStt_ExcptLst = pList;
|
|
|
|
if( !pWrdStt_ExcptLst )
|
|
|
|
{
|
2014-08-11 16:11:09 +02:00
|
|
|
OSL_ENSURE( false, "No valid list" );
|
2012-07-19 12:46:29 +02:00
|
|
|
pWrdStt_ExcptLst = new SvStringsISortDtor;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
nFlags |= WrdSttLstLoad;
|
|
|
|
}
|
2010-11-09 01:42:14 +05:00
|
|
|
|
2005-03-23 10:04:05 +00:00
|
|
|
SvStringsISortDtor* SvxAutoCorrectLanguageLists::GetWrdSttExceptList()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if( !( WrdSttLstLoad & nFlags ) || IsFileChanged_Imp() )
|
|
|
|
SetWrdSttExceptList( LoadWrdSttExceptList() );
|
|
|
|
return pWrdStt_ExcptLst;
|
|
|
|
}
|
2010-11-09 01:42:14 +05:00
|
|
|
|
2013-09-06 14:32:54 +02:00
|
|
|
void SvxAutoCorrectLanguageLists::RemoveStream_Imp( const OUString& rName )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2000-10-18 10:45:13 +00:00
|
|
|
if( sShareAutoCorrFile != sUserAutoCorrFile )
|
|
|
|
{
|
2016-08-27 10:18:06 +02:00
|
|
|
tools::SvRef<SotStorage> xStg = new SotStorage( sUserAutoCorrFile, StreamMode::READWRITE );
|
2000-10-18 10:45:13 +00:00
|
|
|
if( xStg.Is() && SVSTREAM_OK == xStg->GetError() &&
|
|
|
|
xStg->IsStream( rName ) )
|
|
|
|
{
|
|
|
|
xStg->Remove( rName );
|
|
|
|
xStg->Commit();
|
2000-11-30 19:37:11 +00:00
|
|
|
|
2015-11-10 10:14:16 +01:00
|
|
|
xStg = nullptr;
|
2000-10-18 10:45:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl()
|
|
|
|
{
|
2001-05-02 15:18:26 +00:00
|
|
|
// The conversion needs to happen if the file is already in the user
|
|
|
|
// directory and is in the old format. Additionally it needs to
|
|
|
|
// happen when the file is being copied from share to user.
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bError = false, bConvert = false, bCopy = false;
|
2001-05-02 15:18:26 +00:00
|
|
|
INetURLObject aDest;
|
|
|
|
INetURLObject aSource;
|
|
|
|
|
|
|
|
if (sUserAutoCorrFile != sShareAutoCorrFile )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
aSource = INetURLObject ( sShareAutoCorrFile );
|
2001-05-02 15:18:26 +00:00
|
|
|
aDest = INetURLObject ( sUserAutoCorrFile );
|
|
|
|
if ( SotStorage::IsOLEStorage ( sShareAutoCorrFile ) )
|
|
|
|
{
|
2015-11-06 09:35:37 +01:00
|
|
|
aDest.SetExtension ( "bak" );
|
2014-02-26 11:01:45 +02:00
|
|
|
bConvert = true;
|
2001-05-02 15:18:26 +00:00
|
|
|
}
|
2014-02-26 11:01:45 +02:00
|
|
|
bCopy = true;
|
2001-05-02 15:18:26 +00:00
|
|
|
}
|
|
|
|
else if ( SotStorage::IsOLEStorage ( sUserAutoCorrFile ) )
|
|
|
|
{
|
|
|
|
aSource = INetURLObject ( sUserAutoCorrFile );
|
|
|
|
aDest = INetURLObject ( sUserAutoCorrFile );
|
2015-11-06 09:35:37 +01:00
|
|
|
aDest.SetExtension ( "bak" );
|
2014-02-26 11:01:45 +02:00
|
|
|
bCopy = bConvert = true;
|
2001-05-02 15:18:26 +00:00
|
|
|
}
|
|
|
|
if (bCopy)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2016-12-05 08:47:18 +02:00
|
|
|
OUString sMain(aDest.GetMainURL( INetURLObject::DecodeMechanism::ToIUri ));
|
2001-05-02 15:18:26 +00:00
|
|
|
sal_Unicode cSlash = '/';
|
2013-09-26 11:27:22 +02:00
|
|
|
sal_Int32 nSlashPos = sMain.lastIndexOf(cSlash);
|
|
|
|
sMain = sMain.copy(0, nSlashPos);
|
2012-09-14 18:08:57 +02:00
|
|
|
::ucbhelper::Content aNewContent( sMain, uno::Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
|
2001-05-02 15:18:26 +00:00
|
|
|
TransferInfo aInfo;
|
|
|
|
aInfo.NameClash = NameClash::OVERWRITE;
|
|
|
|
aInfo.NewTitle = aDest.GetName();
|
2016-12-05 08:47:18 +02:00
|
|
|
aInfo.SourceURL = aSource.GetMainURL( INetURLObject::DecodeMechanism::ToIUri );
|
2016-04-20 17:16:37 +02:00
|
|
|
aInfo.MoveData = false;
|
2016-05-03 08:39:03 +02:00
|
|
|
aNewContent.executeCommand( "transfer", Any(aInfo));
|
2001-05-02 15:18:26 +00:00
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
bError = true;
|
2001-05-02 15:18:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (bConvert && !bError)
|
|
|
|
{
|
2016-12-05 08:47:18 +02:00
|
|
|
tools::SvRef<SotStorage> xSrcStg = new SotStorage( aDest.GetMainURL( INetURLObject::DecodeMechanism::ToIUri ), StreamMode::READ );
|
2015-05-06 16:33:19 +02:00
|
|
|
tools::SvRef<SotStorage> xDstStg = new SotStorage( sUserAutoCorrFile, StreamMode::WRITE );
|
2000-10-18 10:45:13 +00:00
|
|
|
|
|
|
|
if( xSrcStg.Is() && xDstStg.Is() )
|
|
|
|
{
|
2013-09-20 13:47:10 +02:00
|
|
|
OUString sXMLWord ( pXMLImplWrdStt_ExcptLstStr );
|
|
|
|
OUString sXMLSentence ( pXMLImplCplStt_ExcptLstStr );
|
2015-11-10 10:14:16 +01:00
|
|
|
SvStringsISortDtor *pTmpWordList = nullptr;
|
2001-02-22 13:49:20 +00:00
|
|
|
|
2005-01-11 12:00:28 +00:00
|
|
|
if (xSrcStg->IsContained( sXMLWord ) )
|
2001-02-22 13:49:20 +00:00
|
|
|
LoadXMLExceptList_Imp( pTmpWordList, pXMLImplWrdStt_ExcptLstStr, xSrcStg );
|
|
|
|
|
|
|
|
if (pTmpWordList)
|
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
SaveExceptList_Imp( *pTmpWordList, pXMLImplWrdStt_ExcptLstStr, xDstStg, true );
|
2013-09-05 17:03:39 +02:00
|
|
|
pTmpWordList->clear();
|
2015-11-10 10:14:16 +01:00
|
|
|
pTmpWordList = nullptr;
|
2001-02-22 13:49:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-01-11 12:00:28 +00:00
|
|
|
if (xSrcStg->IsContained( sXMLSentence ) )
|
2001-02-22 13:49:20 +00:00
|
|
|
LoadXMLExceptList_Imp( pTmpWordList, pXMLImplCplStt_ExcptLstStr, xSrcStg );
|
|
|
|
|
|
|
|
if (pTmpWordList)
|
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
SaveExceptList_Imp( *pTmpWordList, pXMLImplCplStt_ExcptLstStr, xDstStg, true );
|
2013-09-05 17:03:39 +02:00
|
|
|
pTmpWordList->clear();
|
2001-02-22 13:49:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GetAutocorrWordList();
|
|
|
|
MakeBlocklist_Imp( *xDstStg );
|
2000-10-18 10:45:13 +00:00
|
|
|
sShareAutoCorrFile = sUserAutoCorrFile;
|
2015-11-10 10:14:16 +01:00
|
|
|
xDstStg = nullptr;
|
2001-05-02 15:18:26 +00:00
|
|
|
try
|
|
|
|
{
|
2016-12-05 08:47:18 +02:00
|
|
|
::ucbhelper::Content aContent ( aDest.GetMainURL( INetURLObject::DecodeMechanism::ToIUri ), uno::Reference < XCommandEnvironment >(), comphelper::getProcessComponentContext() );
|
2015-11-06 09:35:37 +01:00
|
|
|
aContent.executeCommand ( "delete", makeAny ( true ) );
|
2001-05-02 15:18:26 +00:00
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
|
|
|
}
|
2000-10-18 10:45:13 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-11-02 16:06:45 +00:00
|
|
|
else if( bCopy && !bError )
|
|
|
|
sShareAutoCorrFile = sUserAutoCorrFile;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2000-10-18 10:45:13 +00:00
|
|
|
|
2015-05-06 16:30:56 +02:00
|
|
|
bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SotStorage& rStg )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-09-20 13:47:10 +02:00
|
|
|
OUString sStrmName( pXMLImplAutocorr_ListStr, strlen(pXMLImplAutocorr_ListStr), RTL_TEXTENCODING_MS_1252 );
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bRet = true, bRemove = !pAutocorr_List || pAutocorr_List->empty();
|
2000-09-18 16:07:07 +00:00
|
|
|
if( !bRemove )
|
|
|
|
{
|
2015-05-06 16:38:01 +02:00
|
|
|
tools::SvRef<SotStorageStream> refList = rStg.OpenSotStream( sStrmName,
|
2015-01-07 09:28:42 +02:00
|
|
|
( StreamMode::READ | StreamMode::WRITE | StreamMode::SHARE_DENYWRITE ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( refList.Is() )
|
|
|
|
{
|
2001-02-09 17:00:24 +00:00
|
|
|
refList->SetSize( 0 );
|
|
|
|
refList->SetBufferSize( 8192 );
|
2013-09-20 13:47:10 +02:00
|
|
|
OUString aPropName( "MediaType" );
|
2012-05-29 21:35:26 -05:00
|
|
|
OUString aMime( "text/xml" );
|
2016-05-03 08:39:03 +02:00
|
|
|
refList->SetProperty( aPropName, Any(aMime) );
|
2001-05-02 15:18:26 +00:00
|
|
|
|
2012-10-10 10:13:18 +02:00
|
|
|
uno::Reference< uno::XComponentContext > xContext =
|
|
|
|
comphelper::getProcessComponentContext();
|
2001-02-09 17:00:24 +00:00
|
|
|
|
2012-10-10 10:13:18 +02:00
|
|
|
uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext);
|
2007-06-05 13:34:41 +00:00
|
|
|
uno::Reference < io::XOutputStream> xOut = new utl::OOutputStreamWrapper( *refList );
|
2012-10-10 10:13:18 +02:00
|
|
|
xWriter->setOutputStream(xOut);
|
2001-02-09 17:00:24 +00:00
|
|
|
|
2012-10-10 10:13:18 +02:00
|
|
|
uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, uno::UNO_QUERY);
|
2016-05-26 16:02:39 +02:00
|
|
|
rtl::Reference< SvXMLAutoCorrectExport > xExp( new SvXMLAutoCorrectExport( xContext, pAutocorr_List, sStrmName, xHandler ) );
|
2004-05-03 12:27:28 +00:00
|
|
|
|
2015-07-13 16:17:00 +02:00
|
|
|
xExp->exportDoc( XML_BLOCK_LIST );
|
2001-02-09 17:00:24 +00:00
|
|
|
|
|
|
|
refList->Commit();
|
|
|
|
bRet = SVSTREAM_OK == refList->GetError();
|
|
|
|
if( bRet )
|
|
|
|
{
|
|
|
|
refList.Clear();
|
|
|
|
rStg.Commit();
|
|
|
|
if( SVSTREAM_OK != rStg.GetError() )
|
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
bRemove = true;
|
|
|
|
bRet = false;
|
2001-02-09 17:00:24 +00:00
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
2014-02-26 11:01:45 +02:00
|
|
|
bRet = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( bRemove )
|
|
|
|
{
|
|
|
|
rStg.Remove( sStrmName );
|
|
|
|
rStg.Commit();
|
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
2000-10-18 10:45:13 +00:00
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrectLanguageLists::MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNewEntries, std::vector<SvxAutocorrWord>& aDeleteEntries )
|
2012-09-23 21:49:45 +02:00
|
|
|
{
|
|
|
|
// First get the current list!
|
|
|
|
GetAutocorrWordList();
|
|
|
|
|
|
|
|
MakeUserStorage_Impl();
|
2016-08-27 10:18:06 +02:00
|
|
|
tools::SvRef<SotStorage> xStorage = new SotStorage( sUserAutoCorrFile, StreamMode::READWRITE );
|
2012-09-23 21:49:45 +02:00
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bRet = xStorage.Is() && SVSTREAM_OK == xStorage->GetError();
|
2012-09-23 21:49:45 +02:00
|
|
|
|
|
|
|
if( bRet )
|
|
|
|
{
|
2016-04-26 09:08:01 +02:00
|
|
|
for (SvxAutocorrWord & aWordToDelete : aDeleteEntries)
|
2012-09-23 21:49:45 +02:00
|
|
|
{
|
2012-12-10 16:57:36 +00:00
|
|
|
SvxAutocorrWord *pFoundEntry = pAutocorr_List->FindAndRemove( &aWordToDelete );
|
|
|
|
if( pFoundEntry )
|
2012-09-23 21:49:45 +02:00
|
|
|
{
|
|
|
|
if( !pFoundEntry->IsTextOnly() )
|
|
|
|
{
|
2013-09-09 18:50:22 +02:00
|
|
|
OUString aName( aWordToDelete.GetShort() );
|
2012-09-23 21:49:45 +02:00
|
|
|
if (xStorage->IsOLEStorage())
|
2013-09-08 16:34:47 +01:00
|
|
|
aName = EncryptBlockName_Imp(aName);
|
2012-09-23 21:49:45 +02:00
|
|
|
else
|
|
|
|
GeneratePackageName ( aWordToDelete.GetShort(), aName );
|
|
|
|
|
|
|
|
if( xStorage->IsContained( aName ) )
|
|
|
|
{
|
|
|
|
xStorage->Remove( aName );
|
|
|
|
bRet = xStorage->Commit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
delete pFoundEntry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-26 09:08:01 +02:00
|
|
|
for (SvxAutocorrWord & aNewEntrie : aNewEntries)
|
2012-09-23 21:49:45 +02:00
|
|
|
{
|
2016-04-26 09:08:01 +02:00
|
|
|
SvxAutocorrWord *pWordToAdd = new SvxAutocorrWord( aNewEntrie.GetShort(), aNewEntrie.GetLong(), true );
|
2012-12-10 16:57:36 +00:00
|
|
|
SvxAutocorrWord *pRemoved = pAutocorr_List->FindAndRemove( pWordToAdd );
|
|
|
|
if( pRemoved )
|
2012-09-23 21:49:45 +02:00
|
|
|
{
|
2012-12-10 16:57:36 +00:00
|
|
|
if( !pRemoved->IsTextOnly() )
|
2012-09-23 21:49:45 +02:00
|
|
|
{
|
|
|
|
// Still have to remove the Storage
|
2013-09-09 18:50:22 +02:00
|
|
|
OUString sStorageName( pWordToAdd->GetShort() );
|
2012-09-23 21:49:45 +02:00
|
|
|
if (xStorage->IsOLEStorage())
|
2013-09-08 16:34:47 +01:00
|
|
|
sStorageName = EncryptBlockName_Imp(sStorageName);
|
2012-09-23 21:49:45 +02:00
|
|
|
else
|
2012-12-10 16:57:36 +00:00
|
|
|
GeneratePackageName ( pWordToAdd->GetShort(), sStorageName);
|
2012-09-23 21:49:45 +02:00
|
|
|
|
|
|
|
if( xStorage->IsContained( sStorageName ) )
|
|
|
|
xStorage->Remove( sStorageName );
|
|
|
|
}
|
2012-12-10 16:57:36 +00:00
|
|
|
delete pRemoved;
|
2012-09-23 21:49:45 +02:00
|
|
|
}
|
2012-12-10 16:57:36 +00:00
|
|
|
bRet = pAutocorr_List->Insert( pWordToAdd );
|
2012-09-23 21:49:45 +02:00
|
|
|
|
|
|
|
if ( !bRet )
|
|
|
|
{
|
2012-12-10 16:57:36 +00:00
|
|
|
delete pWordToAdd;
|
2012-09-23 21:49:45 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( bRet )
|
|
|
|
{
|
|
|
|
bRet = MakeBlocklist_Imp( *xStorage );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrectLanguageLists::PutText( const OUString& rShort, const OUString& rLong )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// First get the current list!
|
2000-09-18 16:07:07 +00:00
|
|
|
GetAutocorrWordList();
|
|
|
|
|
2000-10-18 10:45:13 +00:00
|
|
|
MakeUserStorage_Impl();
|
2016-08-27 10:18:06 +02:00
|
|
|
tools::SvRef<SotStorage> xStg = new SotStorage( sUserAutoCorrFile, StreamMode::READWRITE );
|
2000-10-18 10:45:13 +00:00
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bRet = xStg.Is() && SVSTREAM_OK == xStg->GetError();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Update the word list
|
2000-09-18 16:07:07 +00:00
|
|
|
if( bRet )
|
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
SvxAutocorrWord* pNew = new SvxAutocorrWord( rShort, rLong, true );
|
2012-12-10 16:57:36 +00:00
|
|
|
SvxAutocorrWord *pRemove = pAutocorr_List->FindAndRemove( pNew );
|
|
|
|
if( pRemove )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-12-10 16:57:36 +00:00
|
|
|
if( !pRemove->IsTextOnly() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// Still have to remove the Storage
|
2013-09-09 18:50:22 +02:00
|
|
|
OUString sStgNm( rShort );
|
2001-05-02 15:18:26 +00:00
|
|
|
if (xStg->IsOLEStorage())
|
2013-09-08 16:34:47 +01:00
|
|
|
sStgNm = EncryptBlockName_Imp(sStgNm);
|
2001-05-02 15:18:26 +00:00
|
|
|
else
|
|
|
|
GeneratePackageName ( rShort, sStgNm);
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if( xStg->IsContained( sStgNm ) )
|
|
|
|
xStg->Remove( sStgNm );
|
|
|
|
}
|
2012-12-10 16:57:36 +00:00
|
|
|
delete pRemove;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2012-12-10 16:57:36 +00:00
|
|
|
if( pAutocorr_List->Insert( pNew ) )
|
2000-11-30 19:37:11 +00:00
|
|
|
{
|
2000-09-18 16:07:07 +00:00
|
|
|
bRet = MakeBlocklist_Imp( *xStg );
|
2015-11-10 10:14:16 +01:00
|
|
|
xStg = nullptr;
|
2000-11-30 19:37:11 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
delete pNew;
|
2014-02-26 11:01:45 +02:00
|
|
|
bRet = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
2010-11-09 01:42:14 +05:00
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool SvxAutoCorrectLanguageLists::PutText( const OUString& rShort,
|
2012-12-10 16:57:36 +00:00
|
|
|
SfxObjectShell& rShell )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// First get the current list!
|
2000-09-18 16:07:07 +00:00
|
|
|
GetAutocorrWordList();
|
|
|
|
|
2000-10-18 10:45:13 +00:00
|
|
|
MakeUserStorage_Impl();
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
bool bRet = false;
|
2013-07-26 15:37:08 +02:00
|
|
|
OUString sLong;
|
2005-01-11 12:00:28 +00:00
|
|
|
try
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2005-01-11 12:00:28 +00:00
|
|
|
uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetStorageFromURL( sUserAutoCorrFile, embed::ElementModes::READWRITE );
|
|
|
|
bRet = rAutoCorrect.PutText( xStg, sUserAutoCorrFile, rShort, rShell, sLong );
|
2015-11-10 10:14:16 +01:00
|
|
|
xStg = nullptr;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Update the word list
|
2005-01-11 12:00:28 +00:00
|
|
|
if( bRet )
|
2000-11-30 19:37:11 +00:00
|
|
|
{
|
2014-02-26 11:01:45 +02:00
|
|
|
SvxAutocorrWord* pNew = new SvxAutocorrWord( rShort, sLong, false );
|
2012-12-10 16:57:36 +00:00
|
|
|
if( pAutocorr_List->Insert( pNew ) )
|
2005-01-11 12:00:28 +00:00
|
|
|
{
|
2016-08-27 10:18:06 +02:00
|
|
|
tools::SvRef<SotStorage> xStor = new SotStorage( sUserAutoCorrFile, StreamMode::READWRITE );
|
2005-01-11 12:00:28 +00:00
|
|
|
MakeBlocklist_Imp( *xStor );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
delete pNew;
|
2000-11-30 19:37:11 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2011-12-09 02:56:30 +09:00
|
|
|
catch ( const uno::Exception& )
|
2005-01-11 12:00:28 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2012-12-10 16:57:36 +00:00
|
|
|
// Keep the list sorted ...
|
2014-11-22 13:32:21 -05:00
|
|
|
struct CompareSvxAutocorrWordList
|
2012-12-10 16:57:36 +00:00
|
|
|
{
|
2014-11-22 13:32:21 -05:00
|
|
|
bool operator()( SvxAutocorrWord* const& lhs, SvxAutocorrWord* const& rhs ) const
|
|
|
|
{
|
|
|
|
CollatorWrapper& rCmp = ::GetCollatorWrapper();
|
|
|
|
return rCmp.compareString( lhs->GetShort(), rhs->GetShort() ) < 0;
|
|
|
|
}
|
|
|
|
};
|
2012-12-10 16:57:36 +00:00
|
|
|
|
2014-11-22 13:23:44 -05:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
typedef std::set<SvxAutocorrWord*, CompareSvxAutocorrWordList> AutocorrWordSetType;
|
2015-01-01 19:58:59 +00:00
|
|
|
typedef std::unordered_map<OUString, SvxAutocorrWord*, OUStringHash> AutocorrWordHashType;
|
2014-11-22 13:23:44 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
struct SvxAutocorrWordList::Impl
|
|
|
|
{
|
|
|
|
|
|
|
|
// only one of these contains the data
|
|
|
|
mutable AutocorrWordSetType maSet;
|
|
|
|
mutable AutocorrWordHashType maHash; // key is 'Short'
|
|
|
|
|
|
|
|
void DeleteAndDestroyAll()
|
|
|
|
{
|
|
|
|
for (AutocorrWordHashType::const_iterator it = maHash.begin(); it != maHash.end(); ++it)
|
|
|
|
delete it->second;
|
|
|
|
maHash.clear();
|
|
|
|
|
|
|
|
for (AutocorrWordSetType::const_iterator it2 = maSet.begin(); it2 != maSet.end(); ++it2)
|
|
|
|
delete *it2;
|
|
|
|
maSet.clear();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
SvxAutocorrWordList::SvxAutocorrWordList() : mpImpl(new Impl) {}
|
2014-11-22 12:37:09 -05:00
|
|
|
|
2012-07-10 14:29:46 +02:00
|
|
|
SvxAutocorrWordList::~SvxAutocorrWordList()
|
|
|
|
{
|
2014-11-22 13:23:44 -05:00
|
|
|
mpImpl->DeleteAndDestroyAll();
|
2012-07-10 14:29:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void SvxAutocorrWordList::DeleteAndDestroyAll()
|
|
|
|
{
|
2014-11-22 13:23:44 -05:00
|
|
|
mpImpl->DeleteAndDestroyAll();
|
2012-07-10 14:29:46 +02:00
|
|
|
}
|
|
|
|
|
2012-12-10 20:41:38 +00:00
|
|
|
// returns true if inserted
|
2013-08-21 13:15:29 +02:00
|
|
|
bool SvxAutocorrWordList::Insert(SvxAutocorrWord *pWord) const
|
2012-12-10 16:57:36 +00:00
|
|
|
{
|
2014-11-22 13:23:44 -05:00
|
|
|
if ( mpImpl->maSet.empty() ) // use the hash
|
2012-12-10 20:41:38 +00:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aShort( pWord->GetShort() );
|
2014-11-22 13:23:44 -05:00
|
|
|
return mpImpl->maHash.insert( std::pair<OUString, SvxAutocorrWord *>( aShort, pWord ) ).second;
|
2012-12-10 20:41:38 +00:00
|
|
|
}
|
|
|
|
else
|
2014-11-22 13:23:44 -05:00
|
|
|
return mpImpl->maSet.insert( pWord ).second;
|
2012-12-10 16:57:36 +00:00
|
|
|
}
|
|
|
|
|
2014-02-26 11:01:45 +02:00
|
|
|
void SvxAutocorrWordList::LoadEntry(const OUString& sWrong, const OUString& sRight, bool bOnlyTxt)
|
2012-12-10 16:57:36 +00:00
|
|
|
{
|
|
|
|
SvxAutocorrWord* pNew = new SvxAutocorrWord( sWrong, sRight, bOnlyTxt );
|
|
|
|
if( !Insert( pNew ) )
|
|
|
|
delete pNew;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SvxAutocorrWordList::empty() const
|
|
|
|
{
|
2014-11-22 13:23:44 -05:00
|
|
|
return mpImpl->maHash.empty() && mpImpl->maSet.empty();
|
2012-12-10 16:57:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SvxAutocorrWord *SvxAutocorrWordList::FindAndRemove(SvxAutocorrWord *pWord)
|
|
|
|
{
|
2015-11-10 10:14:16 +01:00
|
|
|
SvxAutocorrWord *pMatch = nullptr;
|
2012-12-10 20:41:38 +00:00
|
|
|
|
2014-11-22 13:23:44 -05:00
|
|
|
if ( mpImpl->maSet.empty() ) // use the hash
|
2012-12-10 16:57:36 +00:00
|
|
|
{
|
2014-11-22 13:23:44 -05:00
|
|
|
AutocorrWordHashType::iterator it = mpImpl->maHash.find( pWord->GetShort() );
|
|
|
|
if( it != mpImpl->maHash.end() )
|
2012-12-10 20:41:38 +00:00
|
|
|
{
|
|
|
|
pMatch = it->second;
|
2014-11-22 13:23:44 -05:00
|
|
|
mpImpl->maHash.erase (it);
|
2012-12-10 20:41:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-11-22 13:23:44 -05:00
|
|
|
AutocorrWordSetType::iterator it = mpImpl->maSet.find( pWord );
|
|
|
|
if( it != mpImpl->maSet.end() )
|
2012-12-10 20:41:38 +00:00
|
|
|
{
|
|
|
|
pMatch = *it;
|
2014-11-22 13:23:44 -05:00
|
|
|
mpImpl->maSet.erase (it);
|
2012-12-10 20:41:38 +00:00
|
|
|
}
|
2012-12-10 16:57:36 +00:00
|
|
|
}
|
|
|
|
return pMatch;
|
|
|
|
}
|
|
|
|
|
|
|
|
// return the sorted contents - defer sorting until we have to.
|
|
|
|
SvxAutocorrWordList::Content SvxAutocorrWordList::getSortedContent() const
|
|
|
|
{
|
|
|
|
Content aContent;
|
2012-12-10 20:41:38 +00:00
|
|
|
|
|
|
|
// convert from hash to set permanantly
|
2014-11-22 13:23:44 -05:00
|
|
|
if ( mpImpl->maSet.empty() )
|
2012-12-10 20:41:38 +00:00
|
|
|
{
|
2015-09-29 17:50:10 +02:00
|
|
|
// This beast has some O(N log(N)) in a terribly slow ICU collate fn.
|
2014-11-22 13:23:44 -05:00
|
|
|
for (AutocorrWordHashType::const_iterator it = mpImpl->maHash.begin(); it != mpImpl->maHash.end(); ++it)
|
|
|
|
mpImpl->maSet.insert( it->second );
|
|
|
|
mpImpl->maHash.clear();
|
2012-12-10 20:41:38 +00:00
|
|
|
}
|
2014-11-22 13:23:44 -05:00
|
|
|
for (AutocorrWordSetType::const_iterator it = mpImpl->maSet.begin(); it != mpImpl->maSet.end(); ++it)
|
2012-12-10 16:57:36 +00:00
|
|
|
aContent.push_back( *it );
|
2012-12-10 20:41:38 +00:00
|
|
|
|
2012-12-10 16:57:36 +00:00
|
|
|
return aContent;
|
|
|
|
}
|
|
|
|
|
2013-08-21 13:15:29 +02:00
|
|
|
const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *pFnd,
|
2013-09-06 12:57:33 +02:00
|
|
|
const OUString &rTxt,
|
2013-09-18 13:51:35 +01:00
|
|
|
sal_Int32 &rStt,
|
|
|
|
sal_Int32 nEndPos) const
|
2012-12-10 16:57:36 +00:00
|
|
|
{
|
2013-09-20 13:47:10 +02:00
|
|
|
const OUString& rChk = pFnd->GetShort();
|
2014-04-21 12:43:32 +02:00
|
|
|
|
|
|
|
sal_Int32 left_wildcard = rChk.startsWith( ".*" ) ? 2 : 0; // ".*word" pattern?
|
2014-08-01 18:39:26 +02:00
|
|
|
sal_Int32 right_wildcard = rChk.endsWith( ".*" ) ? 2 : 0; // "word.*" pattern?
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 nSttWdPos = nEndPos;
|
2014-08-01 18:39:26 +02:00
|
|
|
|
2015-05-25 04:30:16 +02:00
|
|
|
// direct replacement of keywords surrounded by colons (for example, ":name:")
|
2015-05-26 13:38:22 +02:00
|
|
|
bool bColonNameColon = rTxt.getLength() > nEndPos &&
|
|
|
|
rTxt[nEndPos] == ':' && rChk[0] == ':' && rChk.endsWith(":");
|
2015-05-25 04:30:16 +02:00
|
|
|
if ( nEndPos + (bColonNameColon ? 1 : 0) >= rChk.getLength() - left_wildcard - right_wildcard )
|
2012-12-10 16:57:36 +00:00
|
|
|
{
|
2013-08-23 11:35:27 +02:00
|
|
|
|
2013-08-28 23:55:23 +02:00
|
|
|
bool bWasWordDelim = false;
|
2014-01-15 10:14:52 +00:00
|
|
|
sal_Int32 nCalcStt = nEndPos - rChk.getLength() + left_wildcard;
|
2015-05-25 04:30:16 +02:00
|
|
|
if (bColonNameColon)
|
|
|
|
nCalcStt++;
|
|
|
|
if( !right_wildcard && ( !nCalcStt || nCalcStt == rStt || left_wildcard || bColonNameColon ||
|
2012-12-10 20:41:38 +00:00
|
|
|
( nCalcStt < rStt &&
|
2013-09-06 12:57:33 +02:00
|
|
|
IsWordDelim( rTxt[ nCalcStt - 1 ] ))) )
|
2012-12-10 16:57:36 +00:00
|
|
|
{
|
2012-12-10 20:41:38 +00:00
|
|
|
TransliterationWrapper& rCmp = GetIgnoreTranslWrapper();
|
2013-09-20 13:47:10 +02:00
|
|
|
OUString sWord = rTxt.copy(nCalcStt, rChk.getLength() - left_wildcard);
|
2014-04-21 12:43:32 +02:00
|
|
|
if( (!left_wildcard && rCmp.isEqual( rChk, sWord )) || (left_wildcard && rCmp.isEqual( rChk.copy(left_wildcard), sWord) ))
|
2012-12-10 16:57:36 +00:00
|
|
|
{
|
2012-12-10 20:41:38 +00:00
|
|
|
rStt = nCalcStt;
|
2014-08-31 14:48:01 +02:00
|
|
|
if (!left_wildcard)
|
|
|
|
{
|
|
|
|
// fdo#33899 avoid "1/2", "1/3".. to be replaced by fractions in dates, eg. 1/2/14
|
2014-10-06 14:41:43 +01:00
|
|
|
if (rTxt.getLength() > nEndPos && rTxt[nEndPos] == '/' && rChk.indexOf('/') != -1)
|
2015-11-10 10:14:16 +01:00
|
|
|
return nullptr;
|
2014-08-31 14:48:01 +02:00
|
|
|
return pFnd;
|
|
|
|
}
|
2014-04-21 12:43:32 +02:00
|
|
|
// get the first word delimiter position before the matching ".*word" pattern
|
2013-09-06 12:57:33 +02:00
|
|
|
while( rStt && !(bWasWordDelim = IsWordDelim( rTxt[ --rStt ])))
|
2013-08-23 11:35:27 +02:00
|
|
|
;
|
|
|
|
if (bWasWordDelim) rStt++;
|
2014-04-21 12:43:32 +02:00
|
|
|
OUString left_pattern = rTxt.copy(rStt, nEndPos - rStt - rChk.getLength() + left_wildcard);
|
|
|
|
// avoid double spaces before simple "word" replacement
|
|
|
|
left_pattern += (left_pattern.getLength() == 0 && pFnd->GetLong()[0] == 0x20) ? pFnd->GetLong().copy(1) : pFnd->GetLong();
|
|
|
|
SvxAutocorrWord* pNew = new SvxAutocorrWord(rTxt.copy(rStt, nEndPos - rStt), left_pattern);
|
2013-08-23 11:35:27 +02:00
|
|
|
if( Insert( pNew ) ) return pNew; else delete pNew;
|
2013-08-21 13:15:29 +02:00
|
|
|
}
|
2014-08-01 18:39:26 +02:00
|
|
|
} else
|
|
|
|
// match "word.*" or ".*word.*" patterns, eg. "i18n.*", ".*---.*", TODO: add transliteration support
|
|
|
|
if ( right_wildcard )
|
2013-08-21 13:15:29 +02:00
|
|
|
{
|
2014-08-01 18:39:26 +02:00
|
|
|
|
|
|
|
OUString sTmp( rChk.copy( left_wildcard, rChk.getLength() - left_wildcard - right_wildcard ) );
|
2013-08-21 17:58:06 +02:00
|
|
|
// Get the last word delimiter position
|
|
|
|
bool not_suffix;
|
2014-08-01 18:39:26 +02:00
|
|
|
|
2013-09-06 12:57:33 +02:00
|
|
|
while( nSttWdPos && !(bWasWordDelim = IsWordDelim( rTxt[ --nSttWdPos ])))
|
2013-08-21 17:58:06 +02:00
|
|
|
;
|
2014-08-01 18:39:26 +02:00
|
|
|
// search the first occurrence (with a left word delimitation, if needed)
|
2013-09-06 12:57:33 +02:00
|
|
|
sal_Int32 nFndPos = -1;
|
2013-08-21 13:15:29 +02:00
|
|
|
do {
|
2013-09-06 12:57:33 +02:00
|
|
|
nFndPos = rTxt.indexOf( sTmp, nFndPos + 1);
|
2015-06-14 13:35:37 +02:00
|
|
|
if (nFndPos == -1)
|
|
|
|
break;
|
|
|
|
not_suffix = bWasWordDelim && (nSttWdPos >= (nFndPos + sTmp.getLength()));
|
|
|
|
} while ( (!left_wildcard && nFndPos && !IsWordDelim( rTxt[ nFndPos - 1 ])) || not_suffix );
|
2014-08-01 18:39:26 +02:00
|
|
|
|
2013-09-06 12:57:33 +02:00
|
|
|
if ( nFndPos != -1 )
|
2013-08-21 13:15:29 +02:00
|
|
|
{
|
2014-08-01 18:39:26 +02:00
|
|
|
sal_Int32 extra_repl = nFndPos + sTmp.getLength() > nEndPos ? 1: 0; // for patterns with terminating characters, eg. "a:"
|
|
|
|
|
|
|
|
if ( left_wildcard )
|
|
|
|
{
|
|
|
|
// get the first word delimiter position before the matching ".*word.*" pattern
|
|
|
|
while( nFndPos && !(bWasWordDelim = IsWordDelim( rTxt[ --nFndPos ])))
|
|
|
|
;
|
|
|
|
if (bWasWordDelim) nFndPos++;
|
|
|
|
}
|
2014-08-31 22:06:15 +02:00
|
|
|
if (nEndPos + extra_repl <= nFndPos)
|
|
|
|
{
|
2015-11-10 10:14:16 +01:00
|
|
|
return nullptr;
|
2014-08-31 22:06:15 +02:00
|
|
|
}
|
2013-08-21 13:25:35 +02:00
|
|
|
// store matching pattern and its replacement as a new list item, eg. "i18ns" -> "internationalizations"
|
2014-08-01 18:39:26 +02:00
|
|
|
OUString aShort = rTxt.copy(nFndPos, nEndPos - nFndPos + extra_repl);
|
|
|
|
|
|
|
|
OUString aLong;
|
|
|
|
rStt = nFndPos;
|
|
|
|
if ( !left_wildcard )
|
|
|
|
{
|
|
|
|
sal_Int32 siz = nEndPos - nFndPos - sTmp.getLength();
|
|
|
|
aLong = pFnd->GetLong() + (siz > 0 ? rTxt.copy(nFndPos + sTmp.getLength(), siz) : "");
|
|
|
|
} else {
|
|
|
|
OUStringBuffer buf;
|
|
|
|
do {
|
|
|
|
nSttWdPos = rTxt.indexOf( sTmp, nFndPos);
|
|
|
|
if (nSttWdPos != -1)
|
|
|
|
{
|
2016-09-01 23:06:00 +02:00
|
|
|
sal_Int32 nTmp(nFndPos);
|
|
|
|
while (nTmp < nSttWdPos && !IsWordDelim(rTxt[nTmp]))
|
|
|
|
nTmp++;
|
|
|
|
if (nTmp < nSttWdPos)
|
|
|
|
break; // word delimiter found
|
2014-08-01 18:39:26 +02:00
|
|
|
buf.append(rTxt.copy(nFndPos, nSttWdPos - nFndPos)).append(pFnd->GetLong());
|
|
|
|
nFndPos = nSttWdPos + sTmp.getLength();
|
|
|
|
}
|
|
|
|
} while (nSttWdPos != -1);
|
|
|
|
if (nEndPos - nFndPos > extra_repl) buf.append(rTxt.copy(nFndPos, nEndPos - nFndPos));
|
|
|
|
aLong = buf.makeStringAndClear();
|
|
|
|
}
|
2013-09-06 12:57:33 +02:00
|
|
|
SvxAutocorrWord* pNew = new SvxAutocorrWord(aShort, aLong);
|
2014-08-01 18:39:26 +02:00
|
|
|
if ( Insert( pNew ) )
|
2013-08-21 13:15:29 +02:00
|
|
|
{
|
2016-05-21 02:26:48 +02:00
|
|
|
if ( (rTxt.getLength() > nEndPos && IsWordDelim(rTxt[nEndPos])) || rTxt.getLength() == nEndPos )
|
|
|
|
return pNew;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
delete pNew;
|
2012-12-10 16:57:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-11-10 10:14:16 +01:00
|
|
|
return nullptr;
|
2012-12-10 20:41:38 +00:00
|
|
|
}
|
|
|
|
|
2013-09-18 13:51:35 +01:00
|
|
|
const SvxAutocorrWord* SvxAutocorrWordList::SearchWordsInList(const OUString& rTxt, sal_Int32& rStt,
|
|
|
|
sal_Int32 nEndPos) const
|
2012-12-10 20:41:38 +00:00
|
|
|
{
|
2014-11-22 13:23:44 -05:00
|
|
|
for (AutocorrWordHashType::const_iterator it = mpImpl->maHash.begin(); it != mpImpl->maHash.end(); ++it)
|
2012-12-10 20:41:38 +00:00
|
|
|
{
|
2013-08-21 13:15:29 +02:00
|
|
|
if( const SvxAutocorrWord *aTmp = WordMatches( it->second, rTxt, rStt, nEndPos ) )
|
|
|
|
return aTmp;
|
2012-12-10 20:41:38 +00:00
|
|
|
}
|
|
|
|
|
2014-11-22 13:23:44 -05:00
|
|
|
for (AutocorrWordSetType::const_iterator it2 = mpImpl->maSet.begin(); it2 != mpImpl->maSet.end(); ++it2)
|
2012-12-10 20:41:38 +00:00
|
|
|
{
|
2013-08-21 13:15:29 +02:00
|
|
|
if( const SvxAutocorrWord *aTmp = WordMatches( *it2, rTxt, rStt, nEndPos ) )
|
|
|
|
return aTmp;
|
2012-12-10 20:41:38 +00:00
|
|
|
}
|
2015-11-10 10:14:16 +01:00
|
|
|
return nullptr;
|
2012-12-10 16:57:36 +00:00
|
|
|
}
|
2012-07-10 14:29:46 +02:00
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|