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.
|
|
|
|
*
|
|
|
|
* 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/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
2006-09-17 05:17:36 +00:00
|
|
|
|
2002-09-13 13:31:58 +00:00
|
|
|
#include <algorithm>
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/eeitem.hxx>
|
2002-03-04 17:32:38 +00:00
|
|
|
#include <com/sun/star/i18n/WordType.hpp>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/itemset.hxx>
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/editeng.hxx>
|
|
|
|
#include <editeng/editview.hxx>
|
|
|
|
#include <editeng/unoedhlp.hxx>
|
|
|
|
#include <editeng/editdata.hxx>
|
|
|
|
#include <editeng/outliner.hxx>
|
2013-10-22 15:58:57 +03:00
|
|
|
#include <editeng/editobj.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/unofored.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2002-02-11 11:33:11 +00:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
SvxEditEngineForwarder::SvxEditEngineForwarder( EditEngine& rEngine ) :
|
|
|
|
rEditEngine( rEngine )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxEditEngineForwarder::~SvxEditEngineForwarder()
|
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// the EditEngine may need to be deleted from the outside
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 SvxEditEngineForwarder::GetParagraphCount() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return rEditEngine.GetParagraphCount();
|
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 SvxEditEngineForwarder::GetTextLen( sal_Int32 nParagraph ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return rEditEngine.GetTextLen( nParagraph );
|
|
|
|
}
|
|
|
|
|
2013-09-03 18:29:30 +02:00
|
|
|
OUString SvxEditEngineForwarder::GetText( const ESelection& rSel ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-01-30 11:31:05 +00:00
|
|
|
return convertLineEnd(rEditEngine.GetText(rSel, LINEEND_LF), GetSystemLineEnd());
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-11-13 14:32:11 +00:00
|
|
|
if( rSel.nStartPara == rSel.nEndPara )
|
|
|
|
{
|
2002-02-28 11:25:39 +00:00
|
|
|
sal_uInt8 nFlags = 0;
|
2001-11-13 14:32:11 +00:00
|
|
|
switch( bOnlyHardAttrib )
|
|
|
|
{
|
|
|
|
case EditEngineAttribs_All:
|
|
|
|
nFlags = GETATTRIBS_ALL;
|
|
|
|
break;
|
|
|
|
case EditEngineAttribs_HardAndPara:
|
|
|
|
nFlags = GETATTRIBS_PARAATTRIBS|GETATTRIBS_CHARATTRIBS;
|
|
|
|
break;
|
|
|
|
case EditEngineAttribs_OnlyHard:
|
|
|
|
nFlags = GETATTRIBS_CHARATTRIBS;
|
|
|
|
break;
|
|
|
|
default:
|
2011-03-01 19:07:44 +01:00
|
|
|
OSL_FAIL("unknown flags for SvxOutlinerForwarder::GetAttribs");
|
2001-11-13 14:32:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return rEditEngine.GetAttribs( rSel.nStartPara, rSel.nStartPos, rSel.nEndPos, nFlags );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return rEditEngine.GetAttribs( rSel, bOnlyHardAttrib );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
SfxItemSet SvxEditEngineForwarder::GetParaAttribs( sal_Int32 nPara ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
SfxItemSet aSet( rEditEngine.GetParaAttribs( nPara ) );
|
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_uInt16 nWhich = EE_PARA_START;
|
2000-09-18 16:07:07 +00:00
|
|
|
while( nWhich <= EE_PARA_END )
|
|
|
|
{
|
2014-02-19 21:49:02 +01:00
|
|
|
if( aSet.GetItemState( nWhich, true ) != SFX_ITEM_ON )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if( rEditEngine.HasParaAttrib( nPara, nWhich ) )
|
|
|
|
aSet.Put( rEditEngine.GetParaAttrib( nPara, nWhich ) );
|
|
|
|
}
|
|
|
|
nWhich++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return aSet;
|
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
void SvxEditEngineForwarder::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
rEditEngine.SetParaAttribs( nPara, rSet );
|
|
|
|
}
|
|
|
|
|
2008-07-01 11:52:45 +00:00
|
|
|
void SvxEditEngineForwarder::RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich )
|
|
|
|
{
|
|
|
|
rEditEngine.RemoveAttribs( rSelection, bRemoveParaAttribs, nWhich );
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
SfxItemPool* SvxEditEngineForwarder::GetPool() const
|
|
|
|
{
|
|
|
|
return rEditEngine.GetEmptyItemSet().GetPool();
|
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
void SvxEditEngineForwarder::GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
rEditEngine.GetPortions( nPara, rList );
|
|
|
|
}
|
|
|
|
|
2013-09-03 18:29:30 +02:00
|
|
|
void SvxEditEngineForwarder::QuickInsertText( const OUString& rText, const ESelection& rSel )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
rEditEngine.QuickInsertText( rText, rSel );
|
|
|
|
}
|
|
|
|
|
2001-01-23 10:54:34 +00:00
|
|
|
void SvxEditEngineForwarder::QuickInsertLineBreak( const ESelection& rSel )
|
|
|
|
{
|
|
|
|
rEditEngine.QuickInsertLineBreak( rSel );
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void SvxEditEngineForwarder::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
|
|
|
|
{
|
|
|
|
rEditEngine.QuickInsertField( rFld, rSel );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxEditEngineForwarder::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
|
|
|
|
{
|
|
|
|
rEditEngine.QuickSetAttribs( rSet, rSel );
|
|
|
|
}
|
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_Bool SvxEditEngineForwarder::IsValid() const
|
2002-05-29 14:49:18 +00:00
|
|
|
{
|
|
|
|
// cannot reliably query EditEngine state
|
|
|
|
// while in the middle of an update
|
|
|
|
return rEditEngine.GetUpdateMode();
|
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
OUString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rpTxtColor, Color*& rpFldColor )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return rEditEngine.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
|
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
void SvxEditEngineForwarder::FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos )
|
2010-02-25 16:58:44 +01:00
|
|
|
{
|
|
|
|
rEditEngine.FieldClicked( rField, nPara, nPos );
|
|
|
|
}
|
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-12-23 02:30:41 -05:00
|
|
|
std::vector<EECharAttrib> aAttribs;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
const SfxPoolItem* pLastItem = NULL;
|
|
|
|
|
|
|
|
SfxItemState eState = SFX_ITEM_DEFAULT;
|
|
|
|
|
|
|
|
// check all paragraphs inside the selection
|
2013-05-08 18:12:32 +02:00
|
|
|
for( sal_Int32 nPara = rSel.nStartPara; nPara <= rSel.nEndPara; nPara++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
SfxItemState eParaState = SFX_ITEM_DEFAULT;
|
|
|
|
|
|
|
|
// calculate start and endpos for this paragraph
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 nPos = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( rSel.nStartPara == nPara )
|
|
|
|
nPos = rSel.nStartPos;
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 nEndPos = rSel.nEndPos;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( rSel.nEndPara != nPara )
|
|
|
|
nEndPos = rEditEngine.GetTextLen( nPara );
|
|
|
|
|
|
|
|
|
|
|
|
// get list of char attribs
|
|
|
|
rEditEngine.GetCharAttribs( nPara, aAttribs );
|
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_Bool bEmpty = sal_True; // we found no item inside the selektion of this paragraph
|
|
|
|
sal_Bool bGaps = sal_False; // we found items but theire gaps between them
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 nLastEnd = nPos;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
const SfxPoolItem* pParaItem = NULL;
|
|
|
|
|
2011-12-23 02:30:41 -05:00
|
|
|
for(std::vector<EECharAttrib>::const_iterator i = aAttribs.begin(); i < aAttribs.end(); ++i)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-12-23 02:30:41 -05:00
|
|
|
DBG_ASSERT(i->pAttr, "GetCharAttribs gives corrupt data");
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-12-23 02:30:41 -05:00
|
|
|
const sal_Bool bEmptyPortion = i->nStart == i->nEnd;
|
|
|
|
if((!bEmptyPortion && i->nStart >= nEndPos) ||
|
|
|
|
(bEmptyPortion && i->nStart > nEndPos))
|
2000-09-18 16:07:07 +00:00
|
|
|
break; // break if we are already behind our selektion
|
|
|
|
|
2011-12-23 02:30:41 -05:00
|
|
|
if((!bEmptyPortion && i->nEnd <= nPos) ||
|
|
|
|
(bEmptyPortion && i->nEnd < nPos))
|
2000-09-18 16:07:07 +00:00
|
|
|
continue; // or if the attribute ends before our selektion
|
|
|
|
|
2011-12-23 02:30:41 -05:00
|
|
|
if(i->pAttr->Which() != nWhich)
|
2000-09-18 16:07:07 +00:00
|
|
|
continue; // skip if is not the searched item
|
|
|
|
|
|
|
|
// if we already found an item
|
|
|
|
if( pParaItem )
|
|
|
|
{
|
|
|
|
// ... and its different to this one than the state is dont care
|
2011-12-23 02:30:41 -05:00
|
|
|
if(*pParaItem != *(i->pAttr))
|
2000-09-18 16:07:07 +00:00
|
|
|
return SFX_ITEM_DONTCARE;
|
|
|
|
}
|
|
|
|
else
|
2011-12-23 02:30:41 -05:00
|
|
|
pParaItem = i->pAttr;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( bEmpty )
|
2011-01-13 14:12:48 +01:00
|
|
|
bEmpty = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-12-23 02:30:41 -05:00
|
|
|
if(!bGaps && i->nStart > nLastEnd)
|
2011-01-13 14:12:48 +01:00
|
|
|
bGaps = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-12-23 02:30:41 -05:00
|
|
|
nLastEnd = i->nEnd;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( !bEmpty && !bGaps && nLastEnd < ( nEndPos - 1 ) )
|
2011-01-13 14:12:48 +01:00
|
|
|
bGaps = sal_True;
|
2011-12-23 02:30:41 -05:00
|
|
|
|
2000-11-21 16:34:23 +00:00
|
|
|
if( bEmpty )
|
|
|
|
eParaState = SFX_ITEM_DEFAULT;
|
|
|
|
else if( bGaps )
|
|
|
|
eParaState = SFX_ITEM_DONTCARE;
|
|
|
|
else
|
|
|
|
eParaState = SFX_ITEM_SET;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// if we already found an item check if we found the same
|
|
|
|
if( pLastItem )
|
|
|
|
{
|
|
|
|
if( (pParaItem == NULL) || (*pLastItem != *pParaItem) )
|
|
|
|
return SFX_ITEM_DONTCARE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pLastItem = pParaItem;
|
|
|
|
eState = eParaState;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return eState;
|
|
|
|
}
|
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_uInt16 SvxEditEngineForwarder::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return GetSvxEditEngineItemState( rEditEngine, rSel, nWhich );
|
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_uInt16 SvxEditEngineForwarder::GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
const SfxItemSet& rSet = rEditEngine.GetParaAttribs( nPara );
|
|
|
|
return rSet.GetItemState( nWhich );
|
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
LanguageType SvxEditEngineForwarder::GetLanguage( sal_Int32 nPara, sal_Int32 nIndex ) const
|
2002-02-11 11:33:11 +00:00
|
|
|
{
|
|
|
|
return rEditEngine.GetLanguage(nPara, nIndex);
|
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 SvxEditEngineForwarder::GetFieldCount( sal_Int32 nPara ) const
|
2002-04-11 09:14:17 +00:00
|
|
|
{
|
|
|
|
return rEditEngine.GetFieldCount(nPara);
|
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
EFieldInfo SvxEditEngineForwarder::GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const
|
2002-04-11 09:14:17 +00:00
|
|
|
{
|
|
|
|
return rEditEngine.GetFieldInfo( nPara, nField );
|
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
EBulletInfo SvxEditEngineForwarder::GetBulletInfo( sal_Int32 ) const
|
2002-04-11 09:14:17 +00:00
|
|
|
{
|
|
|
|
return EBulletInfo();
|
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
Rectangle SvxEditEngineForwarder::GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const
|
2002-02-15 08:00:04 +00:00
|
|
|
{
|
2002-09-13 13:13:10 +00:00
|
|
|
// #101701#
|
|
|
|
// EditEngine's 'internal' methods like GetCharacterBounds()
|
|
|
|
// don't rotate for vertical text.
|
2002-09-13 13:31:58 +00:00
|
|
|
Size aSize( rEditEngine.CalcTextWidth(), rEditEngine.GetTextHeight() );
|
|
|
|
::std::swap( aSize.Width(), aSize.Height() );
|
2014-01-21 21:19:12 +01:00
|
|
|
bool bIsVertical( rEditEngine.IsVertical() );
|
2003-04-24 15:59:57 +00:00
|
|
|
|
|
|
|
// #108900# Handle virtual position one-past-the end of the string
|
|
|
|
if( nIndex >= rEditEngine.GetTextLen(nPara) )
|
|
|
|
{
|
2003-06-24 06:40:11 +00:00
|
|
|
Rectangle aLast;
|
2003-04-24 15:59:57 +00:00
|
|
|
|
|
|
|
if( nIndex )
|
2003-06-24 06:40:11 +00:00
|
|
|
{
|
|
|
|
// use last character, if possible
|
2003-04-24 15:59:57 +00:00
|
|
|
aLast = rEditEngine.GetCharacterBounds( EPosition(nPara, nIndex-1) );
|
|
|
|
|
2003-06-24 06:40:11 +00:00
|
|
|
// move at end of this last character, make one pixel wide
|
|
|
|
aLast.Move( aLast.Right() - aLast.Left(), 0 );
|
|
|
|
aLast.SetSize( Size(1, aLast.GetHeight()) );
|
|
|
|
|
|
|
|
// take care for CTL
|
|
|
|
aLast = SvxEditSourceHelper::EEToUserSpace( aLast, aSize, bIsVertical );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// #109864# Bounds must lie within the paragraph
|
|
|
|
aLast = GetParaBounds( nPara );
|
|
|
|
|
|
|
|
// #109151# Don't use paragraph height, but line height
|
|
|
|
// instead. aLast is already CTL-correct
|
|
|
|
if( bIsVertical)
|
|
|
|
aLast.SetSize( Size( rEditEngine.GetLineHeight(nPara,0), 1 ) );
|
|
|
|
else
|
|
|
|
aLast.SetSize( Size( 1, rEditEngine.GetLineHeight(nPara,0) ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
return aLast;
|
2003-04-24 15:59:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return SvxEditSourceHelper::EEToUserSpace( rEditEngine.GetCharacterBounds( EPosition(nPara, nIndex) ),
|
2003-06-24 06:40:11 +00:00
|
|
|
aSize, bIsVertical );
|
2003-04-24 15:59:57 +00:00
|
|
|
}
|
2002-02-15 08:00:04 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
Rectangle SvxEditEngineForwarder::GetParaBounds( sal_Int32 nPara ) const
|
2002-02-11 11:33:11 +00:00
|
|
|
{
|
2002-02-28 11:25:39 +00:00
|
|
|
const Point aPnt = rEditEngine.GetDocPosTopLeft( nPara );
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_uLong nWidth;
|
|
|
|
sal_uLong nHeight;
|
|
|
|
sal_uLong nTextWidth;
|
2002-02-28 11:25:39 +00:00
|
|
|
|
2002-09-13 13:13:10 +00:00
|
|
|
if( rEditEngine.IsVertical() )
|
|
|
|
{
|
|
|
|
// #101701#
|
|
|
|
// Hargl. EditEngine's 'external' methods return the rotated
|
|
|
|
// dimensions, 'internal' methods like GetTextHeight( n )
|
|
|
|
// don't rotate.
|
|
|
|
nWidth = rEditEngine.GetTextHeight( nPara );
|
|
|
|
nHeight = rEditEngine.GetTextHeight();
|
|
|
|
nTextWidth = rEditEngine.GetTextHeight();
|
|
|
|
|
|
|
|
return Rectangle( nTextWidth - aPnt.Y() - nWidth, 0, nTextWidth - aPnt.Y(), nHeight );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nWidth = rEditEngine.CalcTextWidth();
|
|
|
|
nHeight = rEditEngine.GetTextHeight( nPara );
|
|
|
|
|
|
|
|
return Rectangle( 0, aPnt.Y(), nWidth, aPnt.Y() + nHeight );
|
|
|
|
}
|
2002-02-11 11:33:11 +00:00
|
|
|
}
|
|
|
|
|
2002-03-07 14:45:46 +00:00
|
|
|
MapMode SvxEditEngineForwarder::GetMapMode() const
|
|
|
|
{
|
|
|
|
return rEditEngine.GetRefMapMode();
|
|
|
|
}
|
|
|
|
|
2002-04-26 09:27:21 +00:00
|
|
|
OutputDevice* SvxEditEngineForwarder::GetRefDevice() const
|
|
|
|
{
|
|
|
|
return rEditEngine.GetRefDevice();
|
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Bool SvxEditEngineForwarder::GetIndexAtPoint( const Point& rPos, sal_Int32& nPara, sal_Int32& nIndex ) const
|
2002-02-11 11:33:11 +00:00
|
|
|
{
|
2002-09-13 13:31:58 +00:00
|
|
|
Size aSize( rEditEngine.CalcTextWidth(), rEditEngine.GetTextHeight() );
|
|
|
|
::std::swap( aSize.Width(), aSize.Height() );
|
2002-09-13 13:13:10 +00:00
|
|
|
Point aEEPos( SvxEditSourceHelper::UserSpaceToEE( rPos,
|
2002-09-13 13:31:58 +00:00
|
|
|
aSize,
|
2014-01-21 21:19:12 +01:00
|
|
|
rEditEngine.IsVertical() ));
|
2002-09-13 13:13:10 +00:00
|
|
|
|
|
|
|
EPosition aDocPos = rEditEngine.FindDocPosition( aEEPos );
|
2002-03-04 17:32:38 +00:00
|
|
|
|
|
|
|
nPara = aDocPos.nPara;
|
|
|
|
nIndex = aDocPos.nIndex;
|
|
|
|
|
|
|
|
return sal_True;
|
2002-02-11 11:33:11 +00:00
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Bool SvxEditEngineForwarder::GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const
|
2002-02-11 11:33:11 +00:00
|
|
|
{
|
2002-03-04 17:32:38 +00:00
|
|
|
ESelection aRes = rEditEngine.GetWord( ESelection(nPara, nIndex, nPara, nIndex), com::sun::star::i18n::WordType::DICTIONARY_WORD );
|
|
|
|
|
|
|
|
if( aRes.nStartPara == nPara &&
|
|
|
|
aRes.nStartPara == aRes.nEndPara )
|
|
|
|
{
|
|
|
|
nStart = aRes.nStartPos;
|
|
|
|
nEnd = aRes.nEndPos;
|
|
|
|
|
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
|
2002-02-11 11:33:11 +00:00
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
|
2014-02-26 15:30:29 +02:00
|
|
|
bool SvxEditEngineForwarder::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell ) const
|
2002-08-02 10:35:10 +00:00
|
|
|
{
|
2013-11-26 14:25:22 +00:00
|
|
|
return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rEditEngine, nPara, nIndex, bInCell );
|
2002-08-02 10:35:10 +00:00
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 SvxEditEngineForwarder::GetLineCount( sal_Int32 nPara ) const
|
2002-02-11 11:33:11 +00:00
|
|
|
{
|
|
|
|
return rEditEngine.GetLineCount(nPara);
|
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 SvxEditEngineForwarder::GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const
|
2002-02-11 11:33:11 +00:00
|
|
|
{
|
|
|
|
return rEditEngine.GetLineLen(nPara, nLine);
|
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
void SvxEditEngineForwarder::GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nPara, sal_Int32 nLine ) const
|
2009-08-26 13:37:34 +00:00
|
|
|
{
|
|
|
|
rEditEngine.GetLineBoundaries(rStart, rEnd, nPara, nLine);
|
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 SvxEditEngineForwarder::GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const
|
2009-08-26 13:37:34 +00:00
|
|
|
{
|
|
|
|
return rEditEngine.GetLineNumberAtIndex(nPara, nIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_Bool SvxEditEngineForwarder::QuickFormatDoc( sal_Bool )
|
2002-02-11 11:33:11 +00:00
|
|
|
{
|
2002-04-26 09:27:21 +00:00
|
|
|
rEditEngine.QuickFormatDoc();
|
2002-02-11 11:33:11 +00:00
|
|
|
|
2002-04-26 09:27:21 +00:00
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SvxEditEngineForwarder::Delete( const ESelection& rSelection )
|
|
|
|
{
|
|
|
|
rEditEngine.QuickDelete( rSelection );
|
|
|
|
rEditEngine.QuickFormatDoc();
|
2002-02-11 11:33:11 +00:00
|
|
|
|
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
|
2013-09-03 18:29:30 +02:00
|
|
|
sal_Bool SvxEditEngineForwarder::InsertText( const OUString& rStr, const ESelection& rSelection )
|
2002-02-11 11:33:11 +00:00
|
|
|
{
|
2002-04-26 09:27:21 +00:00
|
|
|
rEditEngine.QuickInsertText( rStr, rSelection );
|
|
|
|
rEditEngine.QuickFormatDoc();
|
2002-02-11 11:33:11 +00:00
|
|
|
|
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int16 SvxEditEngineForwarder::GetDepth( sal_Int32 ) const
|
2002-07-26 10:35:10 +00:00
|
|
|
{
|
|
|
|
// EditEngine does not support outline depth
|
2008-06-06 11:37:23 +00:00
|
|
|
return -1;
|
2002-07-26 10:35:10 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Bool SvxEditEngineForwarder::SetDepth( sal_Int32, sal_Int16 nNewDepth )
|
2002-07-26 10:35:10 +00:00
|
|
|
{
|
|
|
|
// EditEngine does not support outline depth
|
2008-06-06 11:37:23 +00:00
|
|
|
return nNewDepth == -1 ? sal_True : sal_False;
|
2002-07-26 10:35:10 +00:00
|
|
|
}
|
|
|
|
|
2007-07-18 12:07:19 +00:00
|
|
|
const SfxItemSet * SvxEditEngineForwarder::GetEmptyItemSetPtr()
|
|
|
|
{
|
|
|
|
return &rEditEngine.GetEmptyItemSet();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxEditEngineForwarder::AppendParagraph()
|
|
|
|
{
|
2013-09-08 17:34:06 +01:00
|
|
|
rEditEngine.InsertParagraph( rEditEngine.GetParagraphCount(), OUString() );
|
2007-07-18 12:07:19 +00:00
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 SvxEditEngineForwarder::AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet & /*rSet*/ )
|
2007-07-18 12:07:19 +00:00
|
|
|
{
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 nLen = 0;
|
2007-07-18 12:07:19 +00:00
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nParaCount = rEditEngine.GetParagraphCount();
|
2007-07-18 12:07:19 +00:00
|
|
|
DBG_ASSERT( nPara < nParaCount, "paragraph index out of bounds" );
|
2013-05-08 18:12:32 +02:00
|
|
|
if (0 <= nPara && nPara < nParaCount)
|
2007-07-18 12:07:19 +00:00
|
|
|
{
|
|
|
|
nLen = rEditEngine.GetTextLen( nPara );
|
|
|
|
rEditEngine.QuickInsertText( rText, ESelection( nPara, nLen, nPara, nLen ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
return nLen;
|
|
|
|
}
|
|
|
|
|
2008-07-01 11:52:45 +00:00
|
|
|
void SvxEditEngineForwarder::CopyText(const SvxTextForwarder& rSource)
|
|
|
|
{
|
|
|
|
const SvxEditEngineForwarder* pSourceForwarder = dynamic_cast< const SvxEditEngineForwarder* >( &rSource );
|
|
|
|
if( !pSourceForwarder )
|
|
|
|
return;
|
|
|
|
EditTextObject* pNewTextObject = pSourceForwarder->rEditEngine.CreateTextObject();
|
|
|
|
rEditEngine.SetText( *pNewTextObject );
|
|
|
|
delete pNewTextObject;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|